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

鸣谢

特别感谢 96bearli, Ovizro, AnyaCoder, jahtim, Honghe, RobertMeow, LUORANCHENG, TinyKiecoo, Barracuda72, GuangChen2333 为本项目提供的帮助和支持。

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

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

Uploaded CPython 3.13Windows x86-64

live2d_py-0.5.3.4-cp313-cp313-win32.whl (253.6 kB view details)

Uploaded CPython 3.13Windows x86

live2d_py-0.5.3.4-cp313-cp313-macosx_14_0_universal2.whl (334.3 kB view details)

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

live2d_py-0.5.3.4-cp312-cp312-win_amd64.whl (281.3 kB view details)

Uploaded CPython 3.12Windows x86-64

live2d_py-0.5.3.4-cp312-cp312-win32.whl (253.6 kB view details)

Uploaded CPython 3.12Windows x86

live2d_py-0.5.3.4-cp312-cp312-macosx_14_0_universal2.whl (334.3 kB view details)

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

live2d_py-0.5.3.4-cp311-cp311-win_amd64.whl (281.4 kB view details)

Uploaded CPython 3.11Windows x86-64

live2d_py-0.5.3.4-cp311-cp311-win32.whl (253.6 kB view details)

Uploaded CPython 3.11Windows x86

live2d_py-0.5.3.4-cp311-cp311-macosx_14_0_universal2.whl (334.3 kB view details)

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

live2d_py-0.5.3.4-cp310-cp310-win_amd64.whl (281.4 kB view details)

Uploaded CPython 3.10Windows x86-64

live2d_py-0.5.3.4-cp310-cp310-win32.whl (253.6 kB view details)

Uploaded CPython 3.10Windows x86

live2d_py-0.5.3.4-cp39-cp39-win_amd64.whl (281.7 kB view details)

Uploaded CPython 3.9Windows x86-64

live2d_py-0.5.3.4-cp39-cp39-win32.whl (253.6 kB view details)

Uploaded CPython 3.9Windows x86

live2d_py-0.5.3.4-cp38-cp38-win_amd64.whl (281.6 kB view details)

Uploaded CPython 3.8Windows x86-64

live2d_py-0.5.3.4-cp38-cp38-win32.whl (253.5 kB view details)

Uploaded CPython 3.8Windows x86

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.4.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

Hashes for live2d_py-0.5.3.4.tar.gz
Algorithm Hash digest
SHA256 a3fcfef8670d240a6627941c0fc22f05e1fc7391941c1a4af3b10b2ac56a76a5
MD5 0e6b7755633d81c82f449507dfaaa256
BLAKE2b-256 c56c604a25fcba9d2458bdaad60a3ba9ca6817db97d497723e145463057891e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 1d8221276f232fe6fa49b2484c1718fa8c7ffd2b12080f5018b43cb8746826b7
MD5 e33fff672a5912e36c8a9b87b04cee38
BLAKE2b-256 431923edc59f5413210dcd42b4ad0fd6cb70f1a7751ddffdf5b420d454bd25c3

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for live2d_py-0.5.3.4-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 a549390bb8adba4f1b24a64dc303260308fb069c53d0b95d30800257716abce6
MD5 553c1683aa7655a19e4cf3d3cbc0f718
BLAKE2b-256 e150f7793c69648a92ea6611f9885593766db3113faec06f607715d99d3acd38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.4-cp313-cp313-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 15bddd8c3c580e696386e87f1aa115ef8f76d78f0c434410b66ca1fdcf31ba5d
MD5 4307dd4e2b3411e5ef810ce9e157d3e1
BLAKE2b-256 5718f5612b20e8f6ed7f23a507c54f5885fe5fa38573b32fbb544b84f5b29cda

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6453b655cc7060f0ee36f526a922b1b1d09ba746c5e953fbf45d6974adf1a360
MD5 3069028f64e9ed2c3decc40086e7aee1
BLAKE2b-256 e6291af50f409840068c1f963563d5d3005ba6032e240aee873b2aa4e71216fb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.4-cp312-cp312-win32.whl
  • Upload date:
  • Size: 253.6 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.3.4-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 8fc5d3464f2e0f049b7c9a9664befe8aeba44562e69d9297188fe3eb178570eb
MD5 e6fee044b56aadaae13a449e5347fc0d
BLAKE2b-256 6e9a455c38251af9d64884b4ca07d4ede518e6b6b9d91c942f57b93d65bb1d93

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.4-cp312-cp312-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 31d2742deaa7bd5817eb17c9cb5e00975fb54f3bc96e54f70488f52521b30b22
MD5 eb72b1a2550e431722493f57d7748581
BLAKE2b-256 71324ac1517a2c2fdc41601c632d2c7eb6d849c8c1470792043a3508154bfa47

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6f62fe57afd15bf1ec4c14a9ff49f162b09c573971a23238071d36844e6ca135
MD5 fc1f95b15071ded45cd7ae730a9d8fd5
BLAKE2b-256 9b2af7b165f788e18afd4dab7696d156f5de5a384b48fb6fb1db61c7f75eb1f7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.4-cp311-cp311-win32.whl
  • Upload date:
  • Size: 253.6 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.3.4-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 64cfe4eee78667931c730adf280c8f9b39f6eaf4afefd812a0ed629914feaeff
MD5 943d779c92cafc29f404ac51fcf2b68b
BLAKE2b-256 2b7ac94429fc2c0df85e1d49dcd1d7605c87395b65f9e93945194cb4713a57ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.4-cp311-cp311-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 3e108631a575aeee2f670c924fb85beffe0031235d098acdec347bfe9f2e58c7
MD5 55489f5f2faf62293055b475d7fe74de
BLAKE2b-256 264658c7816ced86857e7b6e4248aa75cf1a5aea79072f99e7230afc3a3e02f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c8547f6be4670fce4b505a3f17d043f4be6dc2d31340d93a9c66c6f434198b92
MD5 bb1263291f5dd530e8da5ece79960fd6
BLAKE2b-256 554ae03f020335cccc37b32555729455e13bf9bc8ed228aac79d79687e9b0757

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.4-cp310-cp310-win32.whl
  • Upload date:
  • Size: 253.6 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.3.4-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 b8c0f17745cddeb3251f499609416de0121fbd3ae04c524d893a5348ba381833
MD5 378258f00b6a715022023e928ae361ca
BLAKE2b-256 741e9b6e7351e9d6380f3897d02dd9219080077dbfcb0b6d8345a7bf8c15caa5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.4-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 281.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.3.4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 56134e4914ec1cf47748f728a4a169e418dd79d2f3af15eb968dd9e1e5c3851a
MD5 d457c326ca7fddb0b552f0358f2e2bf8
BLAKE2b-256 1478e33d44323fac18e8bace19df602c9fb2d949555628c9c1da29d8f8f1122d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.4-cp39-cp39-win32.whl
  • Upload date:
  • Size: 253.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.5.3.4-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 394fbe048a3f380528e6f7b293cb318419fff3b7ce80a0ec9ddbf819e31fa2ec
MD5 ce2120d359b5eb34416b9837d2aebd67
BLAKE2b-256 4c761430a7f9528f88b4a95986ebbf0f03881e145db755ca7247d17d838ac78b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.4-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 281.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.3.4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 473d3a035dda90ce7485c47dbf0c8e92d3269fb65105458a20a6a62b1551ed38
MD5 e3c11173acf2af8160f0b633a920fdca
BLAKE2b-256 8aaae6c04518468b56f370d55a75d333f74dfb403634ada4619f3335a50c8a16

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.4-cp38-cp38-win32.whl
  • Upload date:
  • Size: 253.5 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.3.4-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 5d1c092e958d51406b9edb0374cd990e1117c43e3946af4490206f1f046d48b7
MD5 919c1c6b6a9bfc696d8ba514b9940099
BLAKE2b-256 2da9bf609429e6597221e884dc753259b7e9619dc4979037475be5005c66b4fd

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