Skip to main content

A non-web Live2D library for Python.

Project description

koe live2d-py


Docker Build Version Python Version CMake C++17 CsmSDK
English README

使用 Python 直接加载和操作 Live2D 模型,不通过 Web Engine 等间接手段进行渲染。

基于 Python C++ API 对 Live2D Native SDK (C++) 进行了封装。理论上,只要配置好 OpenGL 上下文,可在 Python 中将 live2d 绘制在任何基于 OpenGL 的窗口。

代码使用示例:package

详细使用文档:Wiki

修改和开发:CONTRIBUTING

兼容UI库

理论上兼容所有能使用 OpenGL 进行绘制的UI库: Pygame / PyQt5 / PySide2 / PySide6 / GLFW / pyopengltk/ FreeGlut / Qfluentwidgets ...

支持功能

  • 加载模型:Cubism 2.1Cubism 3.0 及以上版本
  • 视线跟踪
  • 点击交互
  • 动作播放回调
  • 口型同步
  • 模型各部分参数控制
  • 各部件透明度控制
  • 精确到部件的点击检测

兼容性

Python 版本

Python 版本支持:从 live2d-py 0.3.2 开始使用 Python C Limited API,理论上兼容 Python 3.2 以上的所有版本。

Cubism Live2D 版本

live2d-py 支持的live2d模型 实现
live2d.v2 Cubism 2.1 以及更早的版本 纯 Python 实现
live2d.v3 Cubism 3.0 及以上版本 Python C Extension 封装

Python 版本及平台

:white_check_mark:: 可用, 支持, 已通过

:question:: 尚未测试

:construction:, :x:: 编译期问题或平台兼容性问题待解决

Platform Python Version live2d.v2 live2d.v3 构建状态 PyPI
MacOS arm64 >3.0, <=3.10 :white_check_mark: :question: :construction: :x:
MacOS arm64 >=3.11 :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
Windows x86/x64 >3.0, <3.8 :white_check_mark: :question: :construction: :x:
Windows x86/x64 >=3.8 :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
Ubuntu 20.04/Arch, x64 >3.0, <3.8 :white_check_mark: :question: :construction: :x:
Ubuntu 20.04/Arch, x64 >=3.8 :white_check_mark: :white_check_mark: :white_check_mark: :x:

注:

  • live2d.v2 由 Cubism Web SDK 转写为纯 Python,尚未使用 numpy 等优化的库,性能有待提升
  • Cubism 2.X 导出的模型:文件名格式常为 XXX.mocXXX.model.jsonXXX.mtn
  • Cubism 3.0 及以上导出的模型:文件名格式常为 XXX.moc3XXX.model3.json, XXX.motion3.json

使用说明

  1. Release 中下载对应版本的 whl 文件并安装(推荐)
pip install live2d_py-0.X.X-cpXXX-cpXXX-win32.whl
  1. 通过 PyPI 安装
pip install live2d-py
  1. 从源码构建,参考 安装#源码构建

示例

简易面捕

源码见 main_facial_bind_mediapipe.py

面捕-期末周破防

基于 live2d-py C 模块及 Qt 开发的 Live2DViewer

Live2DViewer

多模型加载

源码见 main_pygame_three_model.py

three_model

添加背景

源码见 main_pygame_background.py

background

模型变换 & 口型同步音频 & 点击测试

源码见 main_pygame.py

完整用例

模型整体透明度示例

源码见 main_pyqt5_canvas_opacity.py

opacity

鸣谢

特别感谢 96bearli, Ovizro, AnyaCoder, jahtim, Honghe, RobertMeow, LUORANCHENG, TinyKiecoo, Barracuda72 为本项目提供的帮助和支持。

非常感谢以下项目及其贡献者们的帮助:

CubismNativeSamples (live2d.v3)

Cubism2 Web SDK (live2d.v2)

de4jsJavaScript 反混淆工具)

JsConvert (JavascriptPython 工具)

D2Evil (moc 文件分析)

facial-landmarks-for-cubism (面捕参考)

Live2D 模型:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

live2d_py-0.5.3.1.tar.gz (5.7 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

live2d_py-0.5.3.1-cp313-cp313-win_amd64.whl (278.2 kB view details)

Uploaded CPython 3.13Windows x86-64

live2d_py-0.5.3.1-cp313-cp313-win32.whl (250.4 kB view details)

Uploaded CPython 3.13Windows x86

live2d_py-0.5.3.1-cp313-cp313-macosx_14_0_universal2.whl (331.1 kB view details)

Uploaded CPython 3.13macOS 14.0+ universal2 (ARM64, x86-64)

live2d_py-0.5.3.1-cp312-cp312-win_amd64.whl (278.2 kB view details)

Uploaded CPython 3.12Windows x86-64

live2d_py-0.5.3.1-cp312-cp312-win32.whl (250.4 kB view details)

Uploaded CPython 3.12Windows x86

live2d_py-0.5.3.1-cp312-cp312-macosx_14_0_universal2.whl (331.1 kB view details)

Uploaded CPython 3.12macOS 14.0+ universal2 (ARM64, x86-64)

live2d_py-0.5.3.1-cp311-cp311-win_amd64.whl (278.2 kB view details)

Uploaded CPython 3.11Windows x86-64

live2d_py-0.5.3.1-cp311-cp311-win32.whl (250.4 kB view details)

Uploaded CPython 3.11Windows x86

live2d_py-0.5.3.1-cp311-cp311-macosx_14_0_universal2.whl (331.1 kB view details)

Uploaded CPython 3.11macOS 14.0+ universal2 (ARM64, x86-64)

live2d_py-0.5.3.1-cp310-cp310-win_amd64.whl (278.2 kB view details)

Uploaded CPython 3.10Windows x86-64

live2d_py-0.5.3.1-cp310-cp310-win32.whl (250.4 kB view details)

Uploaded CPython 3.10Windows x86

live2d_py-0.5.3.1-cp39-cp39-win_amd64.whl (278.5 kB view details)

Uploaded CPython 3.9Windows x86-64

live2d_py-0.5.3.1-cp39-cp39-win32.whl (250.4 kB view details)

Uploaded CPython 3.9Windows x86

live2d_py-0.5.3.1-cp38-cp38-win_amd64.whl (278.4 kB view details)

Uploaded CPython 3.8Windows x86-64

live2d_py-0.5.3.1-cp38-cp38-win32.whl (250.3 kB view details)

Uploaded CPython 3.8Windows x86

File details

Details for the file live2d_py-0.5.3.1.tar.gz.

File metadata

  • Download URL: live2d_py-0.5.3.1.tar.gz
  • Upload date:
  • Size: 5.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for live2d_py-0.5.3.1.tar.gz
Algorithm Hash digest
SHA256 8b4ec3f78731098d0b3e3c8967e5ddc1e43c9ceb953eddc4ae0b8b184afcb406
MD5 a861a9ffeedbc2e4f457614e785f319c
BLAKE2b-256 2fb4c45d01b8cafbb74c39d3136428108e1492a61bb9e17772c250461f985249

See more details on using hashes here.

File details

Details for the file live2d_py-0.5.3.1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for live2d_py-0.5.3.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f25d1a6aaf34052ff520b987526083bc02ace1e8b79c2bdf46ecb80119e20184
MD5 45ce13a051925ad7f8bcdc61f4ff5747
BLAKE2b-256 0ff08db800227ccf17534ac07099e9de5fe5822278a6d3393d3771e4718bc224

See more details on using hashes here.

File details

Details for the file live2d_py-0.5.3.1-cp313-cp313-win32.whl.

File metadata

  • Download URL: live2d_py-0.5.3.1-cp313-cp313-win32.whl
  • Upload date:
  • Size: 250.4 kB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for live2d_py-0.5.3.1-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 d08f2774b447b2ae7daab992908d1f6c8a90fd0ce2bcec134db04715adb6580d
MD5 05fdb1b4aeadec2326edd7b1053e8439
BLAKE2b-256 b6590ee93388a44527f34eb1b72804a4283479e3beb0f7dd435e1b7e334b447e

See more details on using hashes here.

File details

Details for the file live2d_py-0.5.3.1-cp313-cp313-macosx_14_0_universal2.whl.

File metadata

File hashes

Hashes for live2d_py-0.5.3.1-cp313-cp313-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 8604a654c4077288e4f8330b4e9c698b0204e5ac8120d2f50a69291283b42e48
MD5 69787133a2aed0aaf7636a12a92418de
BLAKE2b-256 4701a339f49e66f3ff489070f519ee60856633de5934029d09bc54a0c07dbe02

See more details on using hashes here.

File details

Details for the file live2d_py-0.5.3.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for live2d_py-0.5.3.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9886a2d6350c49c397fb72b4a6b676bcc341f9213f44cb0f6e96c6e28e58b784
MD5 8618803c33c259d38cb584701ff63d52
BLAKE2b-256 b11d4d18f6dbf0f41b647cae9efd5570603157bd6d8c690650903de889b25f52

See more details on using hashes here.

File details

Details for the file live2d_py-0.5.3.1-cp312-cp312-win32.whl.

File metadata

  • Download URL: live2d_py-0.5.3.1-cp312-cp312-win32.whl
  • Upload date:
  • Size: 250.4 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for live2d_py-0.5.3.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 a591791dc4ba842e52ea1d8241b54c27022188f3f54237963388622e99984021
MD5 2f94b0da72efb55ba6c5bd4ba5cf71f0
BLAKE2b-256 b05149226fbebcb416d861bacaed2bea1c79791fca15a1f2247a252c5016b76c

See more details on using hashes here.

File details

Details for the file live2d_py-0.5.3.1-cp312-cp312-macosx_14_0_universal2.whl.

File metadata

File hashes

Hashes for live2d_py-0.5.3.1-cp312-cp312-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 0a399a59656da9d29331544e3b44e30acaa2ff53eeb415fa680b7afd0e4e159e
MD5 52e27784dda0bfabb0530503d2a4a210
BLAKE2b-256 80eecee1a9c6085b3f24b8e5a5b5282025964bc597cfe5959abf4320b76b477e

See more details on using hashes here.

File details

Details for the file live2d_py-0.5.3.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for live2d_py-0.5.3.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d37d510eed57f05a5310de7beff439f829fe0ea98997473939e7ad1705a6178b
MD5 1c040782fb5065aeeb27aba318a0123b
BLAKE2b-256 2ceccde57f029f0a5c9fe7260fb31dcd6fbda93ec6ce3195c1d1509aabc7dc6c

See more details on using hashes here.

File details

Details for the file live2d_py-0.5.3.1-cp311-cp311-win32.whl.

File metadata

  • Download URL: live2d_py-0.5.3.1-cp311-cp311-win32.whl
  • Upload date:
  • Size: 250.4 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for live2d_py-0.5.3.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 94476156ec60aab1f88057a75a549d7c751c424eacb3dfd6b96994e1e3ccbbbb
MD5 2b6038e9b382dde6e1dd8e16c25869c1
BLAKE2b-256 37eda2a0c1bac804f1d6bf0c33cbec21b6a2381603dc5cf7379e6e03eab99a95

See more details on using hashes here.

File details

Details for the file live2d_py-0.5.3.1-cp311-cp311-macosx_14_0_universal2.whl.

File metadata

File hashes

Hashes for live2d_py-0.5.3.1-cp311-cp311-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 b9c66c02b4430985eabf3735d69356562cbb8a2dc978e13a4e553fed394e54c6
MD5 4cae1d848a44d156e01f10d78a2b489a
BLAKE2b-256 878a7d3420f8908aea67f9854b29024d5f7983f404224e2d56ab19e971df4888

See more details on using hashes here.

File details

Details for the file live2d_py-0.5.3.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for live2d_py-0.5.3.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ee2e5683ca1e75d49fff506b2f0566ebc0618579e2e7365affd159034ade714b
MD5 9ac38e102411b457be25c02a971e69dd
BLAKE2b-256 18f2d993cbbb57b8ff009760bb667aa9d11ae62ce335da2c60ee5b2ce00b5fb6

See more details on using hashes here.

File details

Details for the file live2d_py-0.5.3.1-cp310-cp310-win32.whl.

File metadata

  • Download URL: live2d_py-0.5.3.1-cp310-cp310-win32.whl
  • Upload date:
  • Size: 250.4 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.0

File hashes

Hashes for live2d_py-0.5.3.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 0beb2183ea8139a6f13e3504558ee7d9483a07d6f6c5d7370d6215f714ba7a7f
MD5 33dd94aaf3babcb4cace31bd5be29e7b
BLAKE2b-256 23726fa452b15eb7e223a473a4b3623ddab965a1010f22ea0640086079fa7fc5

See more details on using hashes here.

File details

Details for the file live2d_py-0.5.3.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: live2d_py-0.5.3.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 278.5 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.0

File hashes

Hashes for live2d_py-0.5.3.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 e8189d8d0fc611e876871c53f35c08b6310939d66fa7ed6d24ce79ef9a4892e0
MD5 452145540e41e412ff61daa43cdef0fa
BLAKE2b-256 cd69bc340e5a4669c6dbd07fb846378db4eb2ae39b5496f97037d5eb4bd5132c

See more details on using hashes here.

File details

Details for the file live2d_py-0.5.3.1-cp39-cp39-win32.whl.

File metadata

  • Download URL: live2d_py-0.5.3.1-cp39-cp39-win32.whl
  • Upload date:
  • Size: 250.4 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.0

File hashes

Hashes for live2d_py-0.5.3.1-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 456a390284de0b04db8797d0c1cf82f5c82c29cdac0a70abff0e6d386706af07
MD5 7ce5faf7ed719252c13fbb8e5d3ab4b3
BLAKE2b-256 6e303a2fa4f27e373e9f43621cd47f64ca89565c106acde4cb9458aa4a563900

See more details on using hashes here.

File details

Details for the file live2d_py-0.5.3.1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: live2d_py-0.5.3.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 278.4 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.0

File hashes

Hashes for live2d_py-0.5.3.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 30015e0ad9d35b5a3b921608a839d69956428cdd1a9a89c68ae7b65d14b58066
MD5 d3a55d63ef1d3c584df6836620c3be9d
BLAKE2b-256 9e940e8ea54acb69998a806ad20f250321dc3a7c1b226340088f06f2a930d3d9

See more details on using hashes here.

File details

Details for the file live2d_py-0.5.3.1-cp38-cp38-win32.whl.

File metadata

  • Download URL: live2d_py-0.5.3.1-cp38-cp38-win32.whl
  • Upload date:
  • Size: 250.3 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.0

File hashes

Hashes for live2d_py-0.5.3.1-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 396640c36c51739e5ab1d75a3c9fd9ab13939bbbb981ffdb196f4623bdeaeeac
MD5 31110290062788c676072ee13809f117
BLAKE2b-256 93fe649bbb4fa7460e3540d17a0ea9f89f027f1588d2eb0ec69fa34db65d391b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page