A non-web Live2D library for Python.
Project description
live2d-py
使用 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.1 和 Cubism 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.moc,XXX.model.json,XXX.mtn - Cubism 3.0 及以上导出的模型:文件名格式常为
XXX.moc3,XXX.model3.json,XXX.motion3.json
使用说明
- 在 Release 中下载对应版本的
whl文件并安装(推荐)
pip install live2d_py-0.X.X-cpXXX-cpXXX-win32.whl
- 通过 PyPI 安装
pip install live2d-py
- 从源码构建,参考 安装#源码构建
示例
简易面捕
源码见 main_facial_bind_mediapipe.py
基于 live2d-py C 模块及 Qt 开发的 Live2DViewer
多模型加载
源码见 main_pygame_three_model.py
添加背景
模型变换 & 口型同步音频 & 点击测试
源码见 main_pygame.py
模型整体透明度示例
源码见 main_pyqt5_canvas_opacity.py
鸣谢
特别感谢 96bearli, Ovizro, AnyaCoder, jahtim, Honghe, RobertMeow, LUORANCHENG, TinyKiecoo, Barracuda72 为本项目提供的帮助和支持。
非常感谢以下项目及其贡献者们的帮助:
CubismNativeSamples (live2d.v3)
Cubism2 Web SDK (live2d.v2)
de4js(JavaScript 反混淆工具)
JsConvert (Javascript 转 Python 工具)
D2Evil (moc 文件分析)
facial-landmarks-for-cubism (面捕参考)
Live2D 模型:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file live2d_py-0.5.3.tar.gz.
File metadata
- Download URL: live2d_py-0.5.3.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf831315379555952f8024acd6d9a87199fbd0362a6f701adf23330c3d5b9918
|
|
| MD5 |
8044a4fcd244bffc60cbb58eea609454
|
|
| BLAKE2b-256 |
552d576fce01883bc17e25410a3fdf602ad1a42347d71f2e113dc90785efa60e
|
File details
Details for the file live2d_py-0.5.3-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: live2d_py-0.5.3-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 278.0 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93fc2b6f30cf8eef3af36438886d7e4ac526cdb5b52678f886206d14caf4cea2
|
|
| MD5 |
be44fbbd29aae64efe123b23827b351e
|
|
| BLAKE2b-256 |
842405a0051544cadae6b2d8984b5c8c6cd39fff5f32a4bd6c7440188c0c1ffe
|
File details
Details for the file live2d_py-0.5.3-cp313-cp313-win32.whl.
File metadata
- Download URL: live2d_py-0.5.3-cp313-cp313-win32.whl
- Upload date:
- Size: 250.3 kB
- Tags: CPython 3.13, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6611ac06603e7872ec6dfa3f6c2a3201b422f841b2bada0f7058205c81a9e54b
|
|
| MD5 |
aa8a89b58049b381091ab1417d5d76f9
|
|
| BLAKE2b-256 |
20dcc524646340f8da46099721ca969a6bf857fe2de2fc10f7390395376894ce
|
File details
Details for the file live2d_py-0.5.3-cp313-cp313-macosx_14_0_universal2.whl.
File metadata
- Download URL: live2d_py-0.5.3-cp313-cp313-macosx_14_0_universal2.whl
- Upload date:
- Size: 331.0 kB
- Tags: CPython 3.13, macOS 14.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8e84530bededde4e602e7919591c78664b7113e266cba20e6ce2cbd00133dcc
|
|
| MD5 |
c0c7025b2533534a038fbe5dad7e105b
|
|
| BLAKE2b-256 |
531682873a7abc853322ee62b7e58e2595f07af2a8c62427a092e07ebb14f5f8
|
File details
Details for the file live2d_py-0.5.3-cp313-cp313-macosx_13_0_universal2.whl.
File metadata
- Download URL: live2d_py-0.5.3-cp313-cp313-macosx_13_0_universal2.whl
- Upload date:
- Size: 363.5 kB
- Tags: CPython 3.13, macOS 13.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c2685ea9f24aceff47f685f0775d4ce08caeabc1f33b7e6b45838af43599fe8
|
|
| MD5 |
9ce0235c0d377c31d1d08b3d83148c72
|
|
| BLAKE2b-256 |
3d167f6e5caf7483ef6efafe2faf0bfaa84d071755e2ee198f18647fff577798
|
File details
Details for the file live2d_py-0.5.3-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: live2d_py-0.5.3-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 278.0 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cd6c502786ad68d44f84535d83cc706aef12d659d82c744436da7b257a39581
|
|
| MD5 |
020eeafff3f171e423a7e88f3a2f06d3
|
|
| BLAKE2b-256 |
c1f1df3206f9df6b7ab6b9eea00c38940fc93924ec282b4c971d5e19cfbf1107
|
File details
Details for the file live2d_py-0.5.3-cp312-cp312-win32.whl.
File metadata
- Download URL: live2d_py-0.5.3-cp312-cp312-win32.whl
- Upload date:
- Size: 250.3 kB
- Tags: CPython 3.12, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b51bef5b2e7fce5cc41f02c83ddf3285804441d1e232b2f72e798ea2163b7c3
|
|
| MD5 |
4110b6001b6d42b183f571a91520e228
|
|
| BLAKE2b-256 |
6b35a5f05287ac5f73df60e1d324f6f5a21e81230c2e7ad92f90d7daf7b1d210
|
File details
Details for the file live2d_py-0.5.3-cp312-cp312-macosx_14_0_universal2.whl.
File metadata
- Download URL: live2d_py-0.5.3-cp312-cp312-macosx_14_0_universal2.whl
- Upload date:
- Size: 331.0 kB
- Tags: CPython 3.12, macOS 14.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a46dd06000ca47289217646889ac97247ccfc7b46982a892da9377b59fecfd76
|
|
| MD5 |
9080cb110d8d38e5044fb235247e0307
|
|
| BLAKE2b-256 |
2edda2d22a31c76c44af392718361eb5a33ce93a9ffc866e30188fc92146c051
|
File details
Details for the file live2d_py-0.5.3-cp312-cp312-macosx_13_0_universal2.whl.
File metadata
- Download URL: live2d_py-0.5.3-cp312-cp312-macosx_13_0_universal2.whl
- Upload date:
- Size: 362.9 kB
- Tags: CPython 3.12, macOS 13.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bf37492227c2c3a435197c661a1760e0e0f68864ee8c7f3accf84e7872e12a7
|
|
| MD5 |
42c247e8edc38ed574b21cfab8f0381e
|
|
| BLAKE2b-256 |
5d8383bd0dfd4403166d1826b9627d64ee6ec158873ae19ecfac40d1ecf453dc
|
File details
Details for the file live2d_py-0.5.3-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: live2d_py-0.5.3-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 278.1 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41138d152589f162ce806e9e794a5d600a116d8cde340eca8e16af68cad1e00e
|
|
| MD5 |
6137bf4014243885a42019c4336dc9d8
|
|
| BLAKE2b-256 |
9682d380b1abba2f43a6bca3b39054359e57a7e765931717c4c316698d4e0951
|
File details
Details for the file live2d_py-0.5.3-cp311-cp311-win32.whl.
File metadata
- Download URL: live2d_py-0.5.3-cp311-cp311-win32.whl
- Upload date:
- Size: 250.3 kB
- Tags: CPython 3.11, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e4670948f260b85bfb40c74429cdcbff8882e81a5c91fd01ea8809524e3a6d9
|
|
| MD5 |
171214671e3d470b4ba3334fa7f9b0b7
|
|
| BLAKE2b-256 |
3b7ba07fc1ecb56ee135b14c1e207dcc5fc3abfd70e2956b1c491e8a24060659
|
File details
Details for the file live2d_py-0.5.3-cp311-cp311-macosx_14_0_universal2.whl.
File metadata
- Download URL: live2d_py-0.5.3-cp311-cp311-macosx_14_0_universal2.whl
- Upload date:
- Size: 331.1 kB
- Tags: CPython 3.11, macOS 14.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d202def9b03d556f741b5f0e532886c20fdb8304717d31ac74ba0ceb0120e997
|
|
| MD5 |
807f0cba735f4c1768e46ec3abb89331
|
|
| BLAKE2b-256 |
005f104ff613413a3a414dfd906412ae77be865d787e6ef2d1c76e52d5c4b8bd
|
File details
Details for the file live2d_py-0.5.3-cp311-cp311-macosx_13_0_universal2.whl.
File metadata
- Download URL: live2d_py-0.5.3-cp311-cp311-macosx_13_0_universal2.whl
- Upload date:
- Size: 363.0 kB
- Tags: CPython 3.11, macOS 13.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1fd10d3859c089a429c3c163f2d868747ea412444694074dc4126430a5c7307
|
|
| MD5 |
4bdf7e38a5a12d4c4dca04398b82f6d1
|
|
| BLAKE2b-256 |
8bf974f5e8e9f23800c4f04a04f1ce6ac98d00897e5d9b3e8ab7868c8d74308c
|
File details
Details for the file live2d_py-0.5.3-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: live2d_py-0.5.3-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 278.1 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89258f639749fa215c19dde0733d201d84bbf26aa18e4384df84b40d1cd62ec5
|
|
| MD5 |
17da23dd1c9b9048b28cf981faa64935
|
|
| BLAKE2b-256 |
6207b3a64167ac54709dcdccda7686da0ff7947e3978fd9e11950eb500bde6c5
|
File details
Details for the file live2d_py-0.5.3-cp310-cp310-win32.whl.
File metadata
- Download URL: live2d_py-0.5.3-cp310-cp310-win32.whl
- Upload date:
- Size: 250.3 kB
- Tags: CPython 3.10, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd9e3f6f31be24b4a8b44cf4b16ce0b8e70fb464a83e1ed579d4bd5abef8d5d4
|
|
| MD5 |
af0644f91fa581b418bc4ece8bde5920
|
|
| BLAKE2b-256 |
868602740ea3d0012ee2364fbf451ca26ad41aee7f0afefcd14aec75b03990d1
|
File details
Details for the file live2d_py-0.5.3-cp39-cp39-win_amd64.whl.
File metadata
- Download URL: live2d_py-0.5.3-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 278.3 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43a4da7570b04d0b40ef7d50c0202f3bd28ea1d48bebb3b4da0b1187bb5c790f
|
|
| MD5 |
510ca0da319221cf562f2369c782e5e7
|
|
| BLAKE2b-256 |
c338a1bd22731dc4e0266e5429d447c1710c80a38ff15d22f4f41e5a96adbbea
|
File details
Details for the file live2d_py-0.5.3-cp39-cp39-win32.whl.
File metadata
- Download URL: live2d_py-0.5.3-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a00782c72b88959672856dd5101ab5e83d08a47520f5e5341a8a8ec2110ba7d
|
|
| MD5 |
1713493ab02b6675b71b4c114379f1fc
|
|
| BLAKE2b-256 |
d704abfe89fa5be4522f19dda81da21dfc0c72ae1392bb1b8f63b10decb0771b
|
File details
Details for the file live2d_py-0.5.3-cp38-cp38-win_amd64.whl.
File metadata
- Download URL: live2d_py-0.5.3-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 278.3 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe11cda94fe57755b532987f62b0cff15dbe1ed018a4e58d1e8b2eb52217d575
|
|
| MD5 |
13d659bf0a027f504c70b9b47f300b48
|
|
| BLAKE2b-256 |
5535d1d4063ebf90e53932e22218526485c0567be5f585e5a09cef58657e339e
|
File details
Details for the file live2d_py-0.5.3-cp38-cp38-win32.whl.
File metadata
- Download URL: live2d_py-0.5.3-cp38-cp38-win32.whl
- Upload date:
- Size: 250.4 kB
- Tags: CPython 3.8, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe90b6ef0e18b587592d25b37bc232ba457c0fc90ace6c7d81e0b3baabdad33d
|
|
| MD5 |
db1976c3096a713c09b699c770431d58
|
|
| BLAKE2b-256 |
cf3903d9f80e391869c83a07552e830670174d1ef2fa71e91c5fec0ae9f0790d
|