Skip to main content

A non-web Live2D library for Python.

Project description

koe live2d-py


Docker Build Version Python Version CMake C++17
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. 将仓库中的 package/live2d 直接作为 Python 模块集成到你的项目中即可。

  2. 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.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.4.4-py3-none-any.whl (304.6 kB view details)

Uploaded Python 3

live2d_py-0.4.4-cp313-cp313-win_amd64.whl (255.8 kB view details)

Uploaded CPython 3.13Windows x86-64

live2d_py-0.4.4-cp313-cp313-win32.whl (231.8 kB view details)

Uploaded CPython 3.13Windows x86

live2d_py-0.4.4-cp313-cp313-macosx_14_0_universal2.whl (303.6 kB view details)

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

live2d_py-0.4.4-cp312-cp312-win_amd64.whl (255.8 kB view details)

Uploaded CPython 3.12Windows x86-64

live2d_py-0.4.4-cp312-cp312-win32.whl (231.8 kB view details)

Uploaded CPython 3.12Windows x86

live2d_py-0.4.4-cp312-cp312-macosx_14_0_universal2.whl (303.6 kB view details)

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

live2d_py-0.4.4-cp311-cp311-win_amd64.whl (255.7 kB view details)

Uploaded CPython 3.11Windows x86-64

live2d_py-0.4.4-cp311-cp311-win32.whl (231.7 kB view details)

Uploaded CPython 3.11Windows x86

live2d_py-0.4.4-cp311-cp311-macosx_14_0_universal2.whl (303.5 kB view details)

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

live2d_py-0.4.4-cp310-cp310-win_amd64.whl (254.8 kB view details)

Uploaded CPython 3.10Windows x86-64

live2d_py-0.4.4-cp310-cp310-win32.whl (230.8 kB view details)

Uploaded CPython 3.10Windows x86

live2d_py-0.4.4-cp39-cp39-win_amd64.whl (255.0 kB view details)

Uploaded CPython 3.9Windows x86-64

live2d_py-0.4.4-cp39-cp39-win32.whl (230.8 kB view details)

Uploaded CPython 3.9Windows x86

live2d_py-0.4.4-cp38-cp38-win_amd64.whl (255.0 kB view details)

Uploaded CPython 3.8Windows x86-64

live2d_py-0.4.4-cp38-cp38-win32.whl (230.8 kB view details)

Uploaded CPython 3.8Windows x86

File details

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

File metadata

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

File hashes

Hashes for live2d_py-0.4.4.tar.gz
Algorithm Hash digest
SHA256 b0ff1b7bb7a66d9572148bd46bd4f3d0b3fe12862cca5d9bb9c37f98fa428ae9
MD5 a2eeed232a1884ed0ae6a50395a1010e
BLAKE2b-256 64f71dcc87e0de39f0ebeca863bc99b4e006487edcc1582a17e0cc5ff3a3d5d4

See more details on using hashes here.

File details

Details for the file live2d_py-0.4.4-py3-none-any.whl.

File metadata

  • Download URL: live2d_py-0.4.4-py3-none-any.whl
  • Upload date:
  • Size: 304.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for live2d_py-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 45991a4eb0f8a63a24ba4d97525f7f1b6d0864560f37373f90c11e5951510bf1
MD5 e77fc008efebfc425771114984f1a518
BLAKE2b-256 d60fcbc8ac3a1edb329d4ba401cc3039166503f9df9d37da506cb57b2bfd6e6a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.4-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 255.8 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for live2d_py-0.4.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7abf02553a7e2c39bc646d1734032ab195241dd8be38da8c32a3b6e9a9f24bd1
MD5 14e306d7a1b68234811edc8f8bad1045
BLAKE2b-256 59ed77ea8ae4956a529d34bfa7768feedee996c5d1be5b44cd7efb76fdcf402c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for live2d_py-0.4.4-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 0c2c5e63bcc8ea978ed45b71c4c65d1e64ee943110b40313e38a13591d156b20
MD5 f565bfa93239522cf5abb1447d5ee397
BLAKE2b-256 7cfd6624aef13de63bcbf4e4d4f2f173bbc3cb82832aac3653705e964f7079c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.4-cp313-cp313-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 d70486bdd018317870d705feb9a6614a184f066f8174eec008939fbbe785a2dc
MD5 404ab512c547212633b5edef9a5b7259
BLAKE2b-256 4fbeddc42322db6c9f1688fc6d37db21e441b4ba4c45d48e5c5b5881009c8610

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.4-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 255.8 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.4.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d81146237cafda88bd8da3127fcbc5d3266b12619f72dc82fa8a2e835c1ba98c
MD5 bff9c5b9b24d434f6c734630c03bead7
BLAKE2b-256 79bbc2414cf77570d0b488b124fa84ace59a4bb4d78307fd95bbdbb36b5588fa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.4-cp312-cp312-win32.whl
  • Upload date:
  • Size: 231.8 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.4-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 88100e71b77feade20dcc6d354cda66d8f59e161229f3cb7a3a62e6685bc2bc0
MD5 fda44ff1b4a9a42a621e4d31a87cc767
BLAKE2b-256 8f2467d9c5ac2d01875c75b79feb672cf57b62b6180f595ab37d069cf14a3aa7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.4-cp312-cp312-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 b9d654a7bb0572e73dc8d8bc7740c05e5104428abbd85a71561c193c0842c9f6
MD5 66b4ab376b7f3e3e3d2f7ba5c94d4129
BLAKE2b-256 cbb9ef991fab0353b25481522521b664b99c5566c4a33af668399d104531c63d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.4-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 255.7 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.4.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5d59dc5637db2957ea5ac7ae35b11fc7534f2e7c200782bd841f0ee031424b6a
MD5 3a08f05903ccae37f43a6cff091a27e7
BLAKE2b-256 14d80c2191380f3d16f7825141074e24512918e3694a0f6d7151f34eb7133955

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.4-cp311-cp311-win32.whl
  • Upload date:
  • Size: 231.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.4.4-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 39ef8bfef7a2f555eecd5e168517ebe71b8d8b15196ba15b41dd1e74772b3d72
MD5 74d2a58682a9e29a01b5284f8ae28ef7
BLAKE2b-256 340c24df1bd559601c22de9d174bb68e2639555f2add02934076f01face90f9f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.4-cp311-cp311-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 ddae77895ada1fc6cdb0cf88e3e7ee90d611ff28fd7f130bd4237d13a79731f5
MD5 d1e273e8a249fbba7273875c8f4247a8
BLAKE2b-256 dad2f02b7ab6b375ea12e3019b8f177f766c096b1215ee8658eead9e0b5f9bc8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.4-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 254.8 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.4.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2b61823f1d501bccb9b07c901f08159b20417c5004f95d359ee277aaab9a2b54
MD5 cf67df55f2b6846c97fc578c8bb25a55
BLAKE2b-256 13923358ec2f7638d868a1519bc27cfbef8dc38f71f1c08613db172d7a19e491

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.4-cp310-cp310-win32.whl
  • Upload date:
  • Size: 230.8 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.4-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 7617fcfaf2e48f2e191485bb854699ce052f1d10c20288ba841701e5eb1b7ce7
MD5 a4d12e7f045e8a5b3b63840725a8e55c
BLAKE2b-256 1dfd84cc4f620b01758610ce00716ed89241cc909ed3550a0c5856edbb36f612

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.4-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 255.0 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.4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 0534b370d4df25b959c4fef043c1206c328d7f21312fffa5472032225fb6b2ab
MD5 430ff2ed024ca468741557b7ecda019f
BLAKE2b-256 26c19fe191cc1cf25b708a230663b959bac0967f481620f3c93caa69e3f7afd8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.4-cp39-cp39-win32.whl
  • Upload date:
  • Size: 230.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.4.4-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 f12da09b9677bb6245e4a8f615f09a868cad9e278fc145981dc5dc9bdf06e42c
MD5 0b705d1acae3149f5716b64eb0ad5fd8
BLAKE2b-256 9ae611b0c73e28341aca4cc64b0f1bd5637a4f53af7336e9200cad4b6c83e39e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.4-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 255.0 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.4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 8b1e45f5840ee4dfc706e5ee9c19a7079512327698a7fd068d3eda7ad1eb054e
MD5 49c558f446cffd622e4bd631f0651f69
BLAKE2b-256 565541570774d53542e6427c7331920bdfbeebba20fcefaf400ee7142f651b07

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.4-cp38-cp38-win32.whl
  • Upload date:
  • Size: 230.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.4.4-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 2500a90f8a19ee3187c171a95840f9bd2bcde1e5d6d20ee59a8aff7821bdc41b
MD5 7117eb9d3c6ca8bb59f471ffc4de6665
BLAKE2b-256 492bf08d0dfb282bd6a2e9156d86960a25374b31def4a97573e76fe99f07f5e5

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