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

注意:本仓库中使用到的Live2D Core模块,需要自行前往Live2D官网下载。

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

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

代码使用示例:examples

详细使用文档: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, GuangChen2333, makabakadot, thynetruly, mastwet, KyvYang, @Mozilla88, @CooperWang0912, @minghf85

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

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.6.1.1.tar.gz (456.8 kB 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.6.1.1-cp313-cp313-win_amd64.whl (296.0 kB view details)

Uploaded CPython 3.13Windows x86-64

live2d_py-0.6.1.1-cp313-cp313-win32.whl (268.7 kB view details)

Uploaded CPython 3.13Windows x86

live2d_py-0.6.1.1-cp313-cp313-macosx_15_0_universal2.whl (352.7 kB view details)

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

live2d_py-0.6.1.1-cp312-cp312-win_amd64.whl (295.8 kB view details)

Uploaded CPython 3.12Windows x86-64

live2d_py-0.6.1.1-cp312-cp312-win32.whl (268.5 kB view details)

Uploaded CPython 3.12Windows x86

live2d_py-0.6.1.1-cp312-cp312-macosx_15_0_universal2.whl (352.4 kB view details)

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

live2d_py-0.6.1.1-cp311-cp311-win_amd64.whl (295.8 kB view details)

Uploaded CPython 3.11Windows x86-64

live2d_py-0.6.1.1-cp311-cp311-win32.whl (268.6 kB view details)

Uploaded CPython 3.11Windows x86

live2d_py-0.6.1.1-cp311-cp311-macosx_15_0_universal2.whl (352.6 kB view details)

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

live2d_py-0.6.1.1-cp310-cp310-win_amd64.whl (295.8 kB view details)

Uploaded CPython 3.10Windows x86-64

live2d_py-0.6.1.1-cp310-cp310-win32.whl (268.7 kB view details)

Uploaded CPython 3.10Windows x86

live2d_py-0.6.1.1-cp39-cp39-win_amd64.whl (296.2 kB view details)

Uploaded CPython 3.9Windows x86-64

live2d_py-0.6.1.1-cp39-cp39-win32.whl (268.9 kB view details)

Uploaded CPython 3.9Windows x86

live2d_py-0.6.1.1-cp38-cp38-win_amd64.whl (296.1 kB view details)

Uploaded CPython 3.8Windows x86-64

live2d_py-0.6.1.1-cp38-cp38-win32.whl (268.9 kB view details)

Uploaded CPython 3.8Windows x86

File details

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

File metadata

  • Download URL: live2d_py-0.6.1.1.tar.gz
  • Upload date:
  • Size: 456.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for live2d_py-0.6.1.1.tar.gz
Algorithm Hash digest
SHA256 3f1935fbff1c8786cdafaa812b48662cd1edacd50d7ec67c7b7af474863f1e1b
MD5 921ff31f850742c5adb663b6cd97025b
BLAKE2b-256 577bc7e3c8fb085b5ab629789a2ad653b5931c28c8d5f0223e7aa5b2502047f1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.6.1.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 296.0 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for live2d_py-0.6.1.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ff56decc63d6075388f4077b4152605689d564fc49ca25c705cf16b29f8f6cad
MD5 243b800fcdd3578c5e4e8a72d32f7720
BLAKE2b-256 7361c37fd6afa2bad68127758f0016746d940dc07a7f82d0b425b559e6982dba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.6.1.1-cp313-cp313-win32.whl
  • Upload date:
  • Size: 268.7 kB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for live2d_py-0.6.1.1-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 85c0f9590deb03a7dcdecac531c75ad2209e98ca5a439e86c397f8f704848a09
MD5 e7d0fa45d88271d8e30975ee0a444d21
BLAKE2b-256 4f7a8d314aa659a32b12dc475f6f0074139e854ae1a10cefa7f39de2f25c66c1

See more details on using hashes here.

File details

Details for the file live2d_py-0.6.1.1-cp313-cp313-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for live2d_py-0.6.1.1-cp313-cp313-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 5ec5d0a21a79da17f04b6800ecf26646d4a32323aaed282260907839c87ee41f
MD5 cd3d771333fee53c4c5519ac691621fd
BLAKE2b-256 00adfc0d6c6c48485dbef781bed7f686667302812e86c1beb8f2001c1b46ffc1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.6.1.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3725794c9900a5660d7402366c1674390b872472bb32d58deb0b08d23f2637a4
MD5 3d231a14376c375bcbfea009548f3027
BLAKE2b-256 eeb4bd0fc4960f5ecf1766791fc0dc268d3921513283ace00c9c04894165bd5b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for live2d_py-0.6.1.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 06a662177b4526d5ecfec93e19d38a678b34fdeb5d31f2d513829ddbcea5617e
MD5 3f83a785c4ee5f9512c5956cc3493849
BLAKE2b-256 fec8d068f1f6cf5cccc11a0ec6e19bef566843f85ce2c621552390574bc97f86

See more details on using hashes here.

File details

Details for the file live2d_py-0.6.1.1-cp312-cp312-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for live2d_py-0.6.1.1-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 381b7aecf94a39a171addd9a298e52726900f8e1541b0efa2941f2380bee606f
MD5 65912e08998ee5d1e4cfca409dbce071
BLAKE2b-256 49ea2196136b537904e572b1804d3922ff1b168d6e2a853628aca20b73c7e1b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.6.1.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5855311b6c0ac5a6e49bd2abcc6756ff4b8b6695cd5792e300b47c35c81fd0e2
MD5 0184b01d49aae822d84f0450b91e03ae
BLAKE2b-256 912d0de1ff62561b2f858022ca98e74b7c0be804b90ea5a35676cf808093cb10

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for live2d_py-0.6.1.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 30f23c1ae2f9e3ecfa10c38a663becc11cc5111d39bf1834188672e708bce838
MD5 438037c73b2ae9dedd65446cfdd2b06b
BLAKE2b-256 5ff44cbca20008807e61ed862ef94e7a4bb6220957768c826547c96ca8dfd992

See more details on using hashes here.

File details

Details for the file live2d_py-0.6.1.1-cp311-cp311-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for live2d_py-0.6.1.1-cp311-cp311-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 1c5a1468a4068f105b160dc2abc00a2eca09dadf3daaeb5bed169ef676386434
MD5 5837d1fe3888171cad48cbffbdcb6fbf
BLAKE2b-256 b6b15dd4620d0ec1bfc3055f990b481e7475d5d7a896da71a405f048493a641c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.6.1.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0ede2ef645e9f36d44eb6ee0bee2430b37c397cc4a3f1b9bee1f96b1bbaf5eb1
MD5 1d197ef0c822c49a288bd5de249abf9b
BLAKE2b-256 d3fbd0506a54c555982dc440d06fb4ac35970f653632185c076cc1ee5acb2792

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for live2d_py-0.6.1.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 64817fbf919653ccb55c1c94a294d7974230d8a5f8e0bc1b8946a81c8717e42d
MD5 53b6d3ce64905235b0cb708396aef87a
BLAKE2b-256 f2422d9cfeaf00df7904d4c311c25a3d248371702b26a3988b205c1bca62c1c8

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for live2d_py-0.6.1.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 d17adebdbdbafdb810dcb0bee9981bfbf5a9ddeb508a52f1ca8fa9d360643ee3
MD5 e2314e86c5b0dfa3d0695566d63480c7
BLAKE2b-256 31a40cfed808eb13abbe22ac1a24fb65d0e118d06edebebf6b7cf9ba08449a63

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for live2d_py-0.6.1.1-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 1e88a2c7de7e4a8ce687c1e3b542538056e12e90e827b1ec876a0b70cbf8762d
MD5 b0a8725bb7fbed0ccbf119a14de68358
BLAKE2b-256 f697e3311d7bc3c5a083ea4a7319af074a528f929ee67283d9ac50323618a4cb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.6.1.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 296.1 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.6.1.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 64f5764f79c106f53615f4348cd9514c09e6680ebfd2200a460855041ce69bd8
MD5 30219257290202b918c38f18c5bcb2df
BLAKE2b-256 4630b82ccf8e46832ca39c9e8f948754501fecead1313001759c89cc92d0d0d7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.6.1.1-cp38-cp38-win32.whl
  • Upload date:
  • Size: 268.9 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.6.1.1-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 594dd4c21ab9e229c33eaa3e997b6ebda9843ac410744df3a05a35a8f1abc345
MD5 b10eec2c5258287bf24fac8b2e155320
BLAKE2b-256 0565e982002dd9c1f7af8ccac09bc1f5c1daba77a344605086a11c3e2242d842

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