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

Uploaded CPython 3.13Windows x86-64

live2d_py-0.4.5.1-cp313-cp313-win32.whl (231.1 kB view details)

Uploaded CPython 3.13Windows x86

live2d_py-0.4.5.1-cp313-cp313-macosx_14_0_universal2.whl (302.9 kB view details)

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

live2d_py-0.4.5.1-cp312-cp312-win_amd64.whl (255.2 kB view details)

Uploaded CPython 3.12Windows x86-64

live2d_py-0.4.5.1-cp312-cp312-win32.whl (231.1 kB view details)

Uploaded CPython 3.12Windows x86

live2d_py-0.4.5.1-cp312-cp312-macosx_14_0_universal2.whl (302.9 kB view details)

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

live2d_py-0.4.5.1-cp311-cp311-win_amd64.whl (255.2 kB view details)

Uploaded CPython 3.11Windows x86-64

live2d_py-0.4.5.1-cp311-cp311-win32.whl (231.1 kB view details)

Uploaded CPython 3.11Windows x86

live2d_py-0.4.5.1-cp311-cp311-macosx_14_0_universal2.whl (302.9 kB view details)

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

live2d_py-0.4.5.1-cp310-cp310-win_amd64.whl (255.2 kB view details)

Uploaded CPython 3.10Windows x86-64

live2d_py-0.4.5.1-cp310-cp310-win32.whl (231.1 kB view details)

Uploaded CPython 3.10Windows x86

live2d_py-0.4.5.1-cp39-cp39-win_amd64.whl (255.3 kB view details)

Uploaded CPython 3.9Windows x86-64

live2d_py-0.4.5.1-cp39-cp39-win32.whl (230.9 kB view details)

Uploaded CPython 3.9Windows x86

live2d_py-0.4.5.1-cp38-cp38-win_amd64.whl (255.3 kB view details)

Uploaded CPython 3.8Windows x86-64

live2d_py-0.4.5.1-cp38-cp38-win32.whl (231.1 kB view details)

Uploaded CPython 3.8Windows x86

File details

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

File metadata

  • Download URL: live2d_py-0.4.5.1.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.5.1.tar.gz
Algorithm Hash digest
SHA256 e96f36c6ff33e05da437c578e29fc4726d9f17b9207fb59ece5c47d5ff1bf263
MD5 77b976ad007a6298ad010a0e90d6d727
BLAKE2b-256 a0ac7f177344548c21ecd25e1d4c90637d5aabc6d65817909b3235400d41b734

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.5.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e0e51838589889cb0912ff637d2be80f4dc193872e87a40dee62626b0ce7104e
MD5 fe01a5b53a0d653544a1acf4d57f6f1f
BLAKE2b-256 79c8ef87b1d7124f4d74b987d9dad636ca47c19de949532e4cbc8ea4e6b25385

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.5.1-cp313-cp313-win32.whl
  • Upload date:
  • Size: 231.1 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.5.1-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 b648a8768c58f6ddc7058ca27f6ee763daa4b379ed4593dcca5e0960812658fb
MD5 61a95ddff0c66a35e5585151e29c3b65
BLAKE2b-256 e7b5f603150b3d73d4d5bfb971431b8acdf96e3d625c3194ea5b907e077c9230

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.5.1-cp313-cp313-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 55982584e47baa744f4c79eb902f5c2700995f87d56c7cabb4d79078bce81b19
MD5 af45050a2cd3f145fa0513392c161a62
BLAKE2b-256 5aa4fe9dc1514f3675fd87a0a0d029dd8c2c41838007542125c89f35f8baddc2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.5.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 442298bd46d374e4c4ec9ea6fb7332fdfd1e021fb9c6a0d913f3c383df032268
MD5 3812a49623ab116760049042559c3998
BLAKE2b-256 c813f12d893e5f2f9c1caa635368eb152d904bb3a3f9f976ecf771552eddaabb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.5.1-cp312-cp312-win32.whl
  • Upload date:
  • Size: 231.1 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.5.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 9c46496314d07879bb1cf2749b45695f78db44a6c1432cbdfe2fec9ee1bec706
MD5 9f1303829fa3f2dbe5b7742c772ba6f1
BLAKE2b-256 fa893bebf196129dbf81a3586b86ed051ba1c2777b65d141cfc91e5e42bc0a06

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.5.1-cp312-cp312-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 77a8fc632544f55fd21862ffe6a7f01ac22bbfc46c88add1b7ae485eb447f27a
MD5 9fd7ef0d32fa32877219f10301f01266
BLAKE2b-256 95acc8f1719b6a31a0cb8d8051079b82b621ec929fcdc205f6a04868355645b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.5.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 53f29bf22857a6b7c4fd41b5ae1f1ccde0b95b6e9094df3548bafe8d0d8ded74
MD5 39e5acd45c99f8094f37ec0d1a28e4c1
BLAKE2b-256 647f844a726772bdb2edcd0e6e952787e45a6d5fcc8d67a7923082810b09cd6f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.5.1-cp311-cp311-win32.whl
  • Upload date:
  • Size: 231.1 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.5.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 4009cfec0877ec83a0224c4bce10c2f25b80d4289b887901eecb3fcbea3669b9
MD5 b2deb8c6c97cc4da5c2dcc5a39416d0f
BLAKE2b-256 f40fd9e9bad8abebb0f9b564b56386c11f8a1bf7704b3915dcb64a57a18cf8f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.5.1-cp311-cp311-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 2ac248ca8b0c179c6350d480f3b05996fddd6dba6b040114350fecb1f5f560c9
MD5 8a49a0e0d4d30606de888aa01edba7ac
BLAKE2b-256 beb356ecd11bfc0a6d4d151a77b8c9a1d561536ff2fb61d20b475a26af9b0235

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.5.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 952b76c9d80e91d9861148d99c1c35091cb378a36a8d18f68c270041236044c7
MD5 1e9320036e6c6ecb936f54996e0816ee
BLAKE2b-256 fdee869eead3e12e89ab6346aa769f976f160e3598263a0e0c351b72824b999d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.5.1-cp310-cp310-win32.whl
  • Upload date:
  • Size: 231.1 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.5.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 ac63e49e8245aa48009308ad81da7bf356c0cb53ae63e5780bba4f7d4ea6eb25
MD5 341717ae47f4662b457673bf1e35a3a4
BLAKE2b-256 bea44574261abdaf8cfa60b8955286881965c8bbaa7a7591f75deef81b3cb17e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.5.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 255.3 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.5.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 77f9031dd152df940b3fc741a9dccc73e7a057b4ff43704d53a6a36d402064b6
MD5 6794069041ffa4861d3df67eed1f5b36
BLAKE2b-256 06f2f3b26515ecef90c81ae679dc51d8d88d2dcdc77e1edffda13b57482f830f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.5.1-cp39-cp39-win32.whl
  • Upload date:
  • Size: 230.9 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.5.1-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 367aa6b63cf99a6bf2e2af7102fef9176329b33067b272e62621095e75b253dc
MD5 9d043e8d2adff2fa6f434e38996bebbc
BLAKE2b-256 b4b867ccd04988bd73e4fe7f6a12a0d4d40e1c1cc9c512a7efaf1c0791902920

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.5.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 255.3 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.5.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 e066a7ec2385f47343aedfc61e095ba7e605599466aba59ae774f3b9557b829e
MD5 69c5e7ce3111762e39fb577c0c21e88c
BLAKE2b-256 a9a59e8fe2ddcac0281422925acf8f006d5aa9799cec48de9665946882128ea3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.5.1-cp38-cp38-win32.whl
  • Upload date:
  • Size: 231.1 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.5.1-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 16e0c1b6ebad01203b4c6f16913aeb4b4dfa7282ac4f7cd5930096049fee79bb
MD5 4ddbb5f15178de1812484c0d4718c67c
BLAKE2b-256 d42ac3dd40198f24b998f5aa280bdf2ad14ab1a414a5bd03c60c0a5f0addadd5

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