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

鸣谢

特别感谢 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.5.0.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.0-cp313-cp313-win_amd64.whl (272.3 kB view details)

Uploaded CPython 3.13Windows x86-64

live2d_py-0.5.0-cp313-cp313-win32.whl (244.7 kB view details)

Uploaded CPython 3.13Windows x86

live2d_py-0.5.0-cp313-cp313-macosx_14_0_universal2.whl (325.0 kB view details)

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

live2d_py-0.5.0-cp312-cp312-win_amd64.whl (272.3 kB view details)

Uploaded CPython 3.12Windows x86-64

live2d_py-0.5.0-cp312-cp312-win32.whl (244.7 kB view details)

Uploaded CPython 3.12Windows x86

live2d_py-0.5.0-cp312-cp312-macosx_14_0_universal2.whl (325.0 kB view details)

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

live2d_py-0.5.0-cp311-cp311-win_amd64.whl (272.4 kB view details)

Uploaded CPython 3.11Windows x86-64

live2d_py-0.5.0-cp311-cp311-win32.whl (244.7 kB view details)

Uploaded CPython 3.11Windows x86

live2d_py-0.5.0-cp311-cp311-macosx_14_0_universal2.whl (325.0 kB view details)

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

live2d_py-0.5.0-cp310-cp310-win_amd64.whl (272.4 kB view details)

Uploaded CPython 3.10Windows x86-64

live2d_py-0.5.0-cp310-cp310-win32.whl (244.7 kB view details)

Uploaded CPython 3.10Windows x86

live2d_py-0.5.0-cp39-cp39-win_amd64.whl (272.7 kB view details)

Uploaded CPython 3.9Windows x86-64

live2d_py-0.5.0-cp39-cp39-win32.whl (244.8 kB view details)

Uploaded CPython 3.9Windows x86

live2d_py-0.5.0-cp38-cp38-win_amd64.whl (272.6 kB view details)

Uploaded CPython 3.8Windows x86-64

live2d_py-0.5.0-cp38-cp38-win32.whl (244.8 kB view details)

Uploaded CPython 3.8Windows x86

File details

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

File metadata

  • Download URL: live2d_py-0.5.0.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.5.0.tar.gz
Algorithm Hash digest
SHA256 4a408efc55846a7931a6165d28653918ae30f4f0ae348611d5117f75e96b6d48
MD5 5edfecb7cc70cdf10c0313bd21db9139
BLAKE2b-256 a7901781785535cb3484e8702e504f9e693022f14d690103424fb94dac003aec

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 272.3 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.5.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8bae8cb8f284946c94003a3b923f43f7389b67fa6125ff7bc94d40e065b2a8ed
MD5 a44470aabbc727ae3f54b5eb50a68f78
BLAKE2b-256 3613a6ff5dbbfbd1ad205d322ef495b9615dfdf5c5ca406e2cfe866d13d1327d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.0-cp313-cp313-win32.whl
  • Upload date:
  • Size: 244.7 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.5.0-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 34c3fba30c8c9c6f6ea25ab005e3e1ad6a33b6a28ca29d163381bc466176244a
MD5 b599cd5add823955d2393fc121b83cf6
BLAKE2b-256 2e48ab83c9b9011c0bbb2f87e23a3cf47143c01032a08a4dfebf014b6183fe61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.0-cp313-cp313-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 aad5b00d2a7cf2668970392ceae2b0a25e703d9bb7e71ac49d27bbc5ec8b5732
MD5 781625200404a7b824da9a92f3115e0c
BLAKE2b-256 a76f31366cf4d3150bb8d94caac1d6454f3803a02ad098fda2df8d2a8b273099

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 272.3 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.5.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d07164cb00774c6c356285650173e57cd487c7b941ad51dc1da1e524c56c0ae0
MD5 3d0a0c1050ff2b62a6d82fc5daf82cfe
BLAKE2b-256 2b56bffc37bdfdcff96f36de02b7073442b4258e50a4818765edfd97282e1f0d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.0-cp312-cp312-win32.whl
  • Upload date:
  • Size: 244.7 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.0-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 387396e8973a2df1a119e2be1b911dc58602a3900b5eabe8d271297b5f50aaba
MD5 62c6a8f99a77799c9d655824193692d4
BLAKE2b-256 c40819c986b737dd1838f5fabec6edc3f4c6c1d1067e3ec1f5f1bf4e056cb209

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.0-cp312-cp312-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 05a308c94893f75d38b63f18ef07e459058cc272166df00b506fbaf08931caab
MD5 3a11e183457e7f7aa3de09358a8f76e3
BLAKE2b-256 e83d42a6fd9ea5ee347d00f825844fd22e427f2747c2e7a44b37e0d280956791

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 272.4 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.5.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4d6431b2a3f5013c8c8cf8e294e0787a6b6b0eb67a9542bf8d2ea264303bd222
MD5 291ec8e2662f761a310fbdfffe4904e0
BLAKE2b-256 665aeb299137c777bb468757a7929b2d7e7b6edc7178d28775d8e73c639e2e2e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.0-cp311-cp311-win32.whl
  • Upload date:
  • Size: 244.7 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.0-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 31dc4b8c325860e49dcb3be7a9db7fd1d41afa7cf83083a99eba6d2cf7ad8ca9
MD5 3dc492bacde10276e5687c8071d6882a
BLAKE2b-256 41f046d1f1853084ceafcfa8217fe97ac268a172b508bd5dd8d33866b5f79ef9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.0-cp311-cp311-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 6eddbd2df49293bf842419981d7b52370c48a10074b8458dade4fba23cbdfbf4
MD5 5f529aa94ad2ed0616f8abdfcea5f5a3
BLAKE2b-256 6110cac3aa5eba4e42abd4729f6ca626d56e87af30849b9345137625a13dd5b1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 272.4 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.5.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f5fec6e489b098603f72914930734f023f999767603b087de2ae047e0dd7da63
MD5 495d6f8d5fa24f3e3f9822c4f21d769e
BLAKE2b-256 19868f77dee45a2e3b2e5ff5d21890a816a4179a0eee4198a678c7c6668d819e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.0-cp310-cp310-win32.whl
  • Upload date:
  • Size: 244.7 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.0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 6e822d4b5ee1b45b48ba0cd56f4d8c170b391bee465fbc5ed9cfd4856e95911c
MD5 8ed9a4294841d5c36a2355bfe43e9e16
BLAKE2b-256 0bc6337020cbe0ed206283e27b9e0d18ff35277712b8dfa03a467b07599ee9f1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 272.7 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.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 70261e909d465d9b873f69ade6930556d0fb8d4d26e575fcc015b738ccee8160
MD5 aa6faa86b01beac4584336213bf595cf
BLAKE2b-256 518d4536e5c7137dae55d13f506f6b1b057d17b0809caad9160822817fad18f5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.0-cp39-cp39-win32.whl
  • Upload date:
  • Size: 244.8 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.0-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 fd8b27eae497eb7ab7bc6008a504074d38f58d4c2c953f1289f79aadaeb8276a
MD5 3c02440ccf7fd7ff8ca38ff03bdc3b68
BLAKE2b-256 bba666fb38326b1cfea3004da226287ebcc70e3f85f318d237e43f1088b17d13

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 272.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.5.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 3e37b872f5ba6c6c46bf30a11bcc6bb4786f4b76693d34c2dfd8319e46fedc41
MD5 ee5988c9c9dee45741aae1304ee7cfa4
BLAKE2b-256 a90539d439938bdb680a895ab9cae5f4743fc3d2c4a8e6e81b1eeda98170a4a7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.0-cp38-cp38-win32.whl
  • Upload date:
  • Size: 244.8 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.0-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 5c8e38022ffc200dd8c5645f56904cfefb75c6027a0a3527fe80121f297962d0
MD5 cc566eca61854d918b87e9e3b12d889f
BLAKE2b-256 302aaeaf90183f0e956abcc5a187d5b0090c373eed6334f2364b2b73f203e674

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