Skip to main content

A non-web Live2D library for Python.

Project description

koe live2d-py


Docker Build Version Python Version CMake C++17
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. 将仓库中的 package/live2d 直接作为 Python 模块集成到你的项目中即可。

  2. 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

面捕-期末周破防

多模型加载

源码见 main_pygame_three_model.py

three_model

添加背景

源码见 main_pygame_background.py

background

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

源码见 main_pygame.py

完整用例

模型整体透明度示例

源码见 main_pyqt5_canvas_opacity.py

opacity

鸣谢

特别感谢 96bearliOvizro, AnyaCoder, jahtim, Honghe, RobertMeow 为本项目提供的帮助和支持。

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

CubismNativeSamples (live2d.v3)

Cubism2 Web SDK (live2d.v2)

JsConvert (JavascriptPython 工具)

D2Evil (moc 文件分析)

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

live2d_py-0.4.3-cp312-cp312-win_amd64.whl (254.4 kB view details)

Uploaded CPython 3.12Windows x86-64

live2d_py-0.4.3-cp312-cp312-win32.whl (230.5 kB view details)

Uploaded CPython 3.12Windows x86

live2d_py-0.4.3-cp312-cp312-macosx_14_0_universal2.whl (301.6 kB view details)

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

live2d_py-0.4.3-cp311-cp311-win_amd64.whl (254.3 kB view details)

Uploaded CPython 3.11Windows x86-64

live2d_py-0.4.3-cp311-cp311-win32.whl (230.4 kB view details)

Uploaded CPython 3.11Windows x86

live2d_py-0.4.3-cp311-cp311-macosx_14_0_universal2.whl (301.6 kB view details)

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

live2d_py-0.4.3-cp310-cp310-win_amd64.whl (253.5 kB view details)

Uploaded CPython 3.10Windows x86-64

live2d_py-0.4.3-cp310-cp310-win32.whl (229.5 kB view details)

Uploaded CPython 3.10Windows x86

live2d_py-0.4.3-cp39-cp39-win_amd64.whl (253.6 kB view details)

Uploaded CPython 3.9Windows x86-64

live2d_py-0.4.3-cp39-cp39-win32.whl (229.6 kB view details)

Uploaded CPython 3.9Windows x86

live2d_py-0.4.3-cp38-cp38-win_amd64.whl (253.6 kB view details)

Uploaded CPython 3.8Windows x86-64

live2d_py-0.4.3-cp38-cp38-win32.whl (229.6 kB view details)

Uploaded CPython 3.8Windows x86

File details

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

File metadata

  • Download URL: live2d_py-0.4.3-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 254.4 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

Hashes for live2d_py-0.4.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 158b899d72e5e9aac9b392905f9ee6b9c1696cc0370295c3545fa1225d47a85d
MD5 6db26b3d72380811800aa347da410f24
BLAKE2b-256 b9a5b21b90693d59b1210b4af8000d51257fc2f932ccf5f773484806566a3b66

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.3-cp312-cp312-win32.whl
  • Upload date:
  • Size: 230.5 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.4.3-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 c4b3663d40788c798082d28dffbe9ed0e001294c59602451aa9a8d2b8cbfe622
MD5 32a6a1ecf80928f84cf88013302b1f45
BLAKE2b-256 dfdc8752cf472bbd85f54204d8c1daad92d0430122256bde6bfc8bc90b9dbb1f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.3-cp312-cp312-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 86a13e3a0d4ea5b7971f158249a3e94b5178cb6e3175212a009b868e94660c59
MD5 2fd607a436970882e38489cbe4b4e265
BLAKE2b-256 457d781343764eac41c25524a16e89019d84bc80c0612bbaae7aa64ba046051b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.3-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 254.3 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

Hashes for live2d_py-0.4.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8ae9c141eaf681c28871e4871dddade642fbf5702bc566e5466d035b255255b9
MD5 67ff0c98618471bab18d07ea18bfa754
BLAKE2b-256 73f23fcd75e52ea3eb634a87f8c3576a49d3776f461c348de25dd6bc292e48ba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.3-cp311-cp311-win32.whl
  • Upload date:
  • Size: 230.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.4.3-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 f07ff13cf3ba276c203e04cd89e7b7dd570ce22eb7ef0de6d33cdc0434ad0483
MD5 2586181ea83b6361d0451a66eefc12a2
BLAKE2b-256 90a40d988b9db4c10f1463d4aac8bf396da64249ec45b1aa871a0056d1a7f1a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.3-cp311-cp311-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 6593f534172bd21ed46a63e63486994d7984214dd276ba943091aaf78bc0d940
MD5 15bf6205f1b31bb22f89dcd30fd2d7a8
BLAKE2b-256 52fcdabb93383cc7d99d48e48ff011014c7cec2f3b23e5c86191eee2a9e35160

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.3-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 253.5 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

Hashes for live2d_py-0.4.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b9ca26496ade3d9e21b9257d833cd69b18243f10bf0f12bfc5d0eddc7ff753d0
MD5 a757f9eff81a26a996b51dad254389f5
BLAKE2b-256 8d015041514651bbb07b5931f0d6b8488f80e5dade6f48b955554d728bf108b5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.3-cp310-cp310-win32.whl
  • Upload date:
  • Size: 229.5 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.4.3-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 e62731c605ff0ee11418b4565c4b9bf658c75715e24ad6ebdfb696e9cc9fc00e
MD5 7d3e9352428bd59cc3f92fa6b5a7c6a4
BLAKE2b-256 b3540b79a6bc4b539cb7f293da74bad589905641b1eb903b6f1fb534b8cdd4bd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.3-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 253.6 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.4.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 e4045d9202319ed6c5f23dcbe14f5b02861d88081263e68f3ddc297d49fafb33
MD5 715dfc9a4250a2cc9dc6e1b85a7518d7
BLAKE2b-256 40c835e2da1ddbd01df5cc2f2cbfb9186b9d6c2e9969cdfc6466512d5f37b04d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.3-cp39-cp39-win32.whl
  • Upload date:
  • Size: 229.6 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.4.3-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 46a93fcde4c208b911f9c13b59016e06b6ac4ed87c136f3ead1b20729842e5f8
MD5 f0540c28752ac8c4612ef46d4fa97a84
BLAKE2b-256 415e83e409cae5585e69789fede48816d3b1f3446024786fe2339ef5d647d55d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.3-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 253.6 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.4.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 073fdce628a3fc3597d530562483ec1963961dc1c19dd13b9cecc42b40ae31b0
MD5 6fbd4f9cf208d3559f79f84b28f9c58a
BLAKE2b-256 c9189a59135ca942ae5741e856af6ef682bb47472eae6578904b84ff49229b41

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.3-cp38-cp38-win32.whl
  • Upload date:
  • Size: 229.6 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.4.3-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 e4ce852f4214c6ea2a4110b0f877c576189326f5ba674e291a2c188efc4d8a8f
MD5 85ea4453d7d7483493068de3c6f8031b
BLAKE2b-256 555b41d753d86142c43a230c7e88676919a040cdddf4e71ca0fcbeddf3e1dd8d

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