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

面捕-期末周破防

多模型加载

源码见 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, LUORANCHENG, TinyKiecoo 为本项目提供的帮助和支持。

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

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.4.6.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.4.6-cp313-cp313-win_amd64.whl (255.5 kB view details)

Uploaded CPython 3.13Windows x86-64

live2d_py-0.4.6-cp313-cp313-win32.whl (231.0 kB view details)

Uploaded CPython 3.13Windows x86

live2d_py-0.4.6-cp313-cp313-macosx_14_0_universal2.whl (303.2 kB view details)

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

live2d_py-0.4.6-cp312-cp312-win_amd64.whl (255.5 kB view details)

Uploaded CPython 3.12Windows x86-64

live2d_py-0.4.6-cp312-cp312-win32.whl (231.0 kB view details)

Uploaded CPython 3.12Windows x86

live2d_py-0.4.6-cp312-cp312-macosx_14_0_universal2.whl (303.2 kB view details)

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

live2d_py-0.4.6-cp311-cp311-win_amd64.whl (255.5 kB view details)

Uploaded CPython 3.11Windows x86-64

live2d_py-0.4.6-cp311-cp311-win32.whl (231.0 kB view details)

Uploaded CPython 3.11Windows x86

live2d_py-0.4.6-cp311-cp311-macosx_14_0_universal2.whl (303.3 kB view details)

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

live2d_py-0.4.6-cp310-cp310-win_amd64.whl (255.5 kB view details)

Uploaded CPython 3.10Windows x86-64

live2d_py-0.4.6-cp310-cp310-win32.whl (231.0 kB view details)

Uploaded CPython 3.10Windows x86

live2d_py-0.4.6-cp39-cp39-win_amd64.whl (255.6 kB view details)

Uploaded CPython 3.9Windows x86-64

live2d_py-0.4.6-cp39-cp39-win32.whl (231.1 kB view details)

Uploaded CPython 3.9Windows x86

live2d_py-0.4.6-cp38-cp38-win_amd64.whl (255.6 kB view details)

Uploaded CPython 3.8Windows x86-64

live2d_py-0.4.6-cp38-cp38-win32.whl (231.0 kB view details)

Uploaded CPython 3.8Windows x86

File details

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

File metadata

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

File hashes

Hashes for live2d_py-0.4.6.tar.gz
Algorithm Hash digest
SHA256 13912db85a9f38a7ccbb589fa0f24c4e31e1953ac642a478af75d71d09298620
MD5 8a7769bee46298e84015d57dabbde0af
BLAKE2b-256 6a0bf7cf913e7ede5d6750ee9724885102911cc202e59b8b141e758067358198

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.6-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 255.5 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for live2d_py-0.4.6-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3a5fb1aede67d944d328f8f73af7403d46362f44cf89cede2aa24a2fbb32a22c
MD5 91f439cced8eb9c2a9529ce1c1af8fc7
BLAKE2b-256 1f53811745c225cb45eccc913d8a3280d57ea1db940d7ee0c65328cfe0572689

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for live2d_py-0.4.6-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 348c79ba77fda5aedeeee78b1717031c84d4b1d96fcd061f585e64ebfe285e50
MD5 7ba870ac050d2e84443aac873a8b9cbb
BLAKE2b-256 af74a98a29f65ef3a8795959cad71c0549f50ab2f2d87835927ce5ce1395e0e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.6-cp313-cp313-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 42c01a39d67d23ce4fb61466a4676d7af0138e3759d5cec976ed2691599654ce
MD5 403dacc3fb54fd95575ab2f456742a3b
BLAKE2b-256 c6ba9f1c01761f3c50c6d71547c48bfe9e2606213f3ce1ca9b6e577d01eb4a90

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.6-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 255.5 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.6-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c53b68a7564f391b150f628cf3836794418db713519f4743161b3fb692ee23d1
MD5 ca441940377220ecfe512c586951999a
BLAKE2b-256 4287607746b944bd558d451fbab772c463a8a4cfe13951b2ece1143f9a504e17

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.6-cp312-cp312-win32.whl
  • Upload date:
  • Size: 231.0 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.6-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 a338852b946983efa24f3c0f9e8c9daaa19322803763c90d991fb75916b1b869
MD5 1b37e682d4d60a8807a6fd16daf5c0b2
BLAKE2b-256 4b09a492ee644c41fc6b1ac9e2fe02df5fd0400d0d826e64c5a669dd3aad8290

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.6-cp312-cp312-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 151a03c2c3d1acc783b5300082930c769ecceb1915334380dfe0efeab4d8a267
MD5 cf4dbee91566f036492c4f7bb7456f30
BLAKE2b-256 58831ed4cb366eda4272193c4625ac76dbc1b4ade82226f5ea979451ef42c29b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.6-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 255.5 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.6-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c4fab18a67755ff57a93699b695cb0389870393b6637a6cd4f706e50d6d74c11
MD5 6e966b9069830bf2de5f66b189d23cae
BLAKE2b-256 503321e5a034be13df2859ca8f5eafd19616d07b3e5aac98182b523d3bd5e2c1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.6-cp311-cp311-win32.whl
  • Upload date:
  • Size: 231.0 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.6-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 445469dec5fe1d1bc2df6c9be704a94ad505d60c5bcba39482de0f3d9f114044
MD5 2636cee606be538de30552e9601d97d4
BLAKE2b-256 640a587e078f717b5a10308d00dfd3d0a262892cda06b9971ecf1082bc9b4e38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.6-cp311-cp311-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 91d316f3be03dc3040c91844e5518aa48711fbb3c8af4f27f56eae7c34ce2ba1
MD5 e269546e120b3f3a4687c09cefe59820
BLAKE2b-256 8ee7fe565e7aa52ed0fa26f389df87f4e3660bc6153d0162530dffe6bdee9f21

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.6-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 255.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.6-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d69d4813404dd0655d70ef18a54f5e2755be045454c551567e81ba06498b6f72
MD5 eb5324c5878766530d90160a7ae31cd8
BLAKE2b-256 a3c07146df57299b6f98eb7607541d7837efb15b0a60b55fbe5da8509317a26f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.6-cp310-cp310-win32.whl
  • Upload date:
  • Size: 231.0 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.6-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 7af10850a82931c3606631ffcdf9810af000313a391c5ab2e83047460961d837
MD5 fc4d2959e3e5691d7b22a3b6091cdc0f
BLAKE2b-256 399d51e2a0de5dad43167d896d93e8fba5aadad9f9a14b6e93f2e645f8c805ce

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.6-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 255.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.6-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 bd7328db27ed97dbf22ecb7fe3e69267355f6304655d567570ffc980a4e6eaa2
MD5 0a9f328dec00ac2abaf921f9f9f0b527
BLAKE2b-256 ce58131db09552bfb6c29e84a0316d9847ab6d128cc3e425264fd326574acc16

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.6-cp39-cp39-win32.whl
  • Upload date:
  • Size: 231.1 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.6-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 1f43f15afa43a6cc5471913fadc743feb34e5746dd684213920dce2f76107f75
MD5 f445683db2b1512085f1557968cc7049
BLAKE2b-256 122eaee1926a665b81d256ae0688f2c1f7cff9c9714e2764d2702bc68423dcc5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.6-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 255.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.6-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 83615e69627134b0071f4d3659c96000d89174047f91eaf37d0821db4eb7466a
MD5 d85c9acb41c1244ba4e2b02e44aaf1f0
BLAKE2b-256 abc84a03a6c661953ae4c7f0c4c937ec1766abfca515c6ed30550f4fbed22e5c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.6-cp38-cp38-win32.whl
  • Upload date:
  • Size: 231.0 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.6-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 b201b4005d057e8122aa44483260054bc561a4de36e55403a944a401f3db10c0
MD5 f6381b985356310e6df670d9d8bc6306
BLAKE2b-256 841f23c974702ec2bd94d804d27a6d5eb19d09ce8e64bdcc271fbb73633bf753

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