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 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 为本项目提供的帮助和支持。

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

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

Uploaded CPython 3.13Windows x86-64

live2d_py-0.5.3.5-cp313-cp313-win32.whl (257.6 kB view details)

Uploaded CPython 3.13Windows x86

live2d_py-0.5.3.5-cp313-cp313-macosx_14_0_universal2.whl (338.7 kB view details)

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

live2d_py-0.5.3.5-cp312-cp312-win_amd64.whl (284.0 kB view details)

Uploaded CPython 3.12Windows x86-64

live2d_py-0.5.3.5-cp312-cp312-win32.whl (257.5 kB view details)

Uploaded CPython 3.12Windows x86

live2d_py-0.5.3.5-cp312-cp312-macosx_14_0_universal2.whl (338.6 kB view details)

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

live2d_py-0.5.3.5-cp311-cp311-win_amd64.whl (284.1 kB view details)

Uploaded CPython 3.11Windows x86-64

live2d_py-0.5.3.5-cp311-cp311-win32.whl (257.5 kB view details)

Uploaded CPython 3.11Windows x86

live2d_py-0.5.3.5-cp311-cp311-macosx_14_0_universal2.whl (338.6 kB view details)

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

live2d_py-0.5.3.5-cp310-cp310-win_amd64.whl (284.1 kB view details)

Uploaded CPython 3.10Windows x86-64

live2d_py-0.5.3.5-cp310-cp310-win32.whl (257.5 kB view details)

Uploaded CPython 3.10Windows x86

live2d_py-0.5.3.5-cp39-cp39-win_amd64.whl (284.4 kB view details)

Uploaded CPython 3.9Windows x86-64

live2d_py-0.5.3.5-cp39-cp39-win32.whl (257.6 kB view details)

Uploaded CPython 3.9Windows x86

live2d_py-0.5.3.5-cp38-cp38-win_amd64.whl (284.4 kB view details)

Uploaded CPython 3.8Windows x86-64

live2d_py-0.5.3.5-cp38-cp38-win32.whl (257.6 kB view details)

Uploaded CPython 3.8Windows x86

File details

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

File metadata

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

File hashes

Hashes for live2d_py-0.5.3.5.tar.gz
Algorithm Hash digest
SHA256 3a5d09f4776d6c0a6baec8d361f69f9c0af860f142084f9294a0d704660c367e
MD5 018bb1784570d58c714af3a0c2185e08
BLAKE2b-256 9f93d88b9719258603147402ebde42a6c3d475d459e78362481a78aed557be60

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 fc24fd2cf1b5acaffacf89f9de824ba58f7433135816c38854bd5c2afaccce89
MD5 bd3ff7db25873caf74fbcf44173393e9
BLAKE2b-256 78dbec175f54d75c1f8d96758de087cb885aa4c467547f32f4cb618a0ea949eb

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for live2d_py-0.5.3.5-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 232466886f33732977b1d867ee0bd47c7a9f577e0080e9cbe237fd24166ba452
MD5 60e7b3b54dba3cb8b80327fabeaae1e6
BLAKE2b-256 06978f2ab1926ed7e1933cae485a04c175e1dd40101aeaefdb49e80e8e0f74ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.5-cp313-cp313-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 f821d9f4112459dad27025c2c86f712dfbdabc0c8b9327f874b940471012475c
MD5 876126bfb2679ce5de5533a163a57f31
BLAKE2b-256 a346d29525c7f9cce204b2525deba8fadaf1d7a3d036cefc7099c37137f23a18

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2eb94494c48457f39769a09498ae4145b6bc87cab9d88a8b7c2ba089db8a0333
MD5 a18eebb7c59e671c88ed9828f0248eba
BLAKE2b-256 5329d5c5d14e21bcdae177a35e42108872e9e7e16b04d19cc82817eec5e89a96

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.5-cp312-cp312-win32.whl
  • Upload date:
  • Size: 257.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.5.3.5-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 7565d8d7a060eca4e3f02432dc11dfe46496679a406bb496c13fe7e3dbcb9124
MD5 8471e65fbd236313ac2a40fca42d8ce4
BLAKE2b-256 e7cbccca37ae3524b551411c3d4c31a8a82d0d990da2b455367b3d272f04ccdc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.5-cp312-cp312-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 dbe7ac1722bb5a9b5fc21592e549eee944e4caa4c55dfe9101e6e58464401125
MD5 885a35502b34da5dd52106a3065df93d
BLAKE2b-256 d30116619a9460bafddc20bcb5dd6ceaab9a1767c067167e5a1c28c94b430416

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 780418b56b25fc512c6e9d7f52b773e72708283ea9bf48b2164ebc8af7a822de
MD5 69da881c6c8002632369a904f6458cd2
BLAKE2b-256 d6ac0d3f8d56e2a7d62ad163b9ee0ff56ca5395e298871db01b4e168209037c1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.5-cp311-cp311-win32.whl
  • Upload date:
  • Size: 257.5 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.5-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 d44fbd9f97cf7942ff20c1b89271e3d9ceecc3bee712bd8371ed0ded2ae34f8a
MD5 1d991e8e4a80253dbf5da2748a8f9498
BLAKE2b-256 a250d4a57669796ca95a6a3914689de735efe4a009f7dd0339df05ac57815181

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.5-cp311-cp311-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 dbb2f17032fb624c6476594f083aa8253af0cb96b801ca86b45230339261d51d
MD5 0c915c30a0f3c50422c8669db88924c3
BLAKE2b-256 73a494b0c0902bbc5473a41989b9fff8c6806354bef3083af0ee3f1fad9d9e58

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9f272d5329ad6b1e9f9555d945143eaf972143445d16b427648817508e37011e
MD5 46424ef69f047fa2da2b62c76d47ffb2
BLAKE2b-256 cf91d3f0aad0befa9d0336b25fef01d9287ec3bc84ccb33f8ba4399aa408cdb3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.5-cp310-cp310-win32.whl
  • Upload date:
  • Size: 257.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.5.3.5-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 f867d214973ce7e5f85a137ca6d3e6955deacbdcb676d53b3ad9b6fc80a8a5f9
MD5 63f1758a89d29f2fed52f35ff7a033f3
BLAKE2b-256 a1824393b5940e7eabda339d2be0499e3a1a8dafe006889042470f3f37dfdc34

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.5-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 284.4 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.5-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 801b19d460c7ce9b90b536acb7012ad5f38854d7e8a4218b5ca54aacafc6c4b0
MD5 016688fc3d1218616f4e2e741a77311d
BLAKE2b-256 d4369a326defc7549c4976e7353c4e3208e294a6a8881edc20ac869dbcc9b6d4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.5-cp39-cp39-win32.whl
  • Upload date:
  • Size: 257.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.5-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 4a554457d843c61b1cd21bc1ea2b48ccf32551801d991e3d4718a87121dbf922
MD5 ddae5e7f6ffeb5f1d8ce2eafebc92750
BLAKE2b-256 4b64cb3ff336df2291fe67cf6e3ccd2362ecb2b955c5e6cc3e8e2c93e5886150

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.5-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 284.4 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.5-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 fcfe9ba30cc7771197a721847efe4141619fe35ded3776bb380f780f9d3f6b77
MD5 099ee5a1168a46d7ec1e186c1cea5211
BLAKE2b-256 a8ae5de0a9621df3239fb2f5fc131cc01460ef0eef093defc87a195f3632b37d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.5-cp38-cp38-win32.whl
  • Upload date:
  • Size: 257.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.5.3.5-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 ed502e76a2c97389204b390b850dacbdf4e8744adeb25d0f4d0bdcf4b59886cc
MD5 179bf1db79ee682c8a25cedf6baa8099
BLAKE2b-256 8c6f9b9c29552603795770a351604e1ea9ad78355f611e5dce97ab31ff9de05e

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