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

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

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.2.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.5.2.1-cp313-cp313-win_amd64.whl (276.1 kB view details)

Uploaded CPython 3.13Windows x86-64

live2d_py-0.5.2.1-cp313-cp313-win32.whl (248.3 kB view details)

Uploaded CPython 3.13Windows x86

live2d_py-0.5.2.1-cp313-cp313-macosx_14_0_universal2.whl (329.4 kB view details)

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

live2d_py-0.5.2.1-cp312-cp312-win_amd64.whl (276.1 kB view details)

Uploaded CPython 3.12Windows x86-64

live2d_py-0.5.2.1-cp312-cp312-win32.whl (248.3 kB view details)

Uploaded CPython 3.12Windows x86

live2d_py-0.5.2.1-cp312-cp312-macosx_14_0_universal2.whl (329.4 kB view details)

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

live2d_py-0.5.2.1-cp311-cp311-win_amd64.whl (276.1 kB view details)

Uploaded CPython 3.11Windows x86-64

live2d_py-0.5.2.1-cp311-cp311-win32.whl (248.3 kB view details)

Uploaded CPython 3.11Windows x86

live2d_py-0.5.2.1-cp311-cp311-macosx_14_0_universal2.whl (329.5 kB view details)

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

live2d_py-0.5.2.1-cp310-cp310-win_amd64.whl (276.1 kB view details)

Uploaded CPython 3.10Windows x86-64

live2d_py-0.5.2.1-cp310-cp310-win32.whl (248.3 kB view details)

Uploaded CPython 3.10Windows x86

live2d_py-0.5.2.1-cp39-cp39-win_amd64.whl (276.4 kB view details)

Uploaded CPython 3.9Windows x86-64

live2d_py-0.5.2.1-cp39-cp39-win32.whl (248.4 kB view details)

Uploaded CPython 3.9Windows x86

live2d_py-0.5.2.1-cp38-cp38-win_amd64.whl (276.3 kB view details)

Uploaded CPython 3.8Windows x86-64

live2d_py-0.5.2.1-cp38-cp38-win32.whl (248.4 kB view details)

Uploaded CPython 3.8Windows x86

File details

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

File metadata

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

File hashes

Hashes for live2d_py-0.5.2.1.tar.gz
Algorithm Hash digest
SHA256 72470955b5c863c81ec00d7df02c2ea53e03b38434020a85dd868bc28121b0dd
MD5 83de9e344fb035c631b0771cc9fe33f4
BLAKE2b-256 c72be88e40323c5fd0db50858d2dcfd163214b5acae401d6dd81e44f408cc8dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.2.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c2e8e1dcaca482d95993d6933c6d8a3e4a1cfcd8a5c99c8de65541b536acaf3a
MD5 7a14843e2ab365c1135012278f1846a8
BLAKE2b-256 3b8e56b065f77c32cae58c1de3540629bbb1c95d80242a7dc6e9847b21dfedde

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.2.1-cp313-cp313-win32.whl
  • Upload date:
  • Size: 248.3 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.2.1-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 779437a896481260d56d437526f06d3eb08df690e35c400d8ab18ef8ea2d70b3
MD5 0c2b6e623438725142b30d2f34b0cd19
BLAKE2b-256 80ec854a872d970e07708c37dc667ec09361cb2bcec24965dc69c0cf4f8dcdbe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.2.1-cp313-cp313-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 0f452b89c27b0c451b81a99fd0b5dfc0bb65ebb37408851fe065d8acefa58829
MD5 bfd6c1648296f3855da30ea8874014f5
BLAKE2b-256 e0606a210003ac44f9e98fee22bf7df2792c459f0b316604453e047226d67c1d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.2.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7d6be60b86b44b81e4be171e1a2593b73875e2f6b9fd1dadaf16393f6c828309
MD5 3cd2ef6fa99abf74754cd4c3395fdb3c
BLAKE2b-256 a301df8c150e6a7b1aaf5cba37ce1c4859996e4845f1cc3edf3f254addeb18a1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.2.1-cp312-cp312-win32.whl
  • Upload date:
  • Size: 248.3 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.2.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 ac3132d5c81354c927b26083c5f25fcc2d44de555a5c9002dbe4483d6f495b23
MD5 6907133fbc10195285a5269ce5e2ae30
BLAKE2b-256 c0e29122a680e01ca3f1a81d0fe057590ad640a0fa6c5f1a0b71208325fc8242

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.2.1-cp312-cp312-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 1033bf24cc8b8150210346215ed34625090bb0ec88e8a859c648d7ff33237f98
MD5 626136e518fcb746ca12368116636884
BLAKE2b-256 9a92ebdf9008fda7d2cc289300f5193646686671461d83be51c8e8d65c4b5559

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.2.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 37a620cd879a1766856a94de5bae14d3cd95c3e17df96f253870ea26f29164c8
MD5 a7bebb0b95c0af0c588dfa5277b89e99
BLAKE2b-256 3b71591052ccae0d8eb9fee43d623be767d86a44020bf65b2c1bde452043afb0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.2.1-cp311-cp311-win32.whl
  • Upload date:
  • Size: 248.3 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.2.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 000021890aa67fc877b4fd22a5ac2b42b6da5622c556b7e275bde8218c98bb64
MD5 8ce7fa17bd6e3c1084ffaaf6e5a61518
BLAKE2b-256 dfddf50ac884988d3db72de8fd131d9d1c43942a3c6c28fcf5fb746c60681b2c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.2.1-cp311-cp311-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 b0f242c263f345c74b5f653b7d64ed3b23b86adbb567e2243d5603f2e4220032
MD5 0e11ef11957c9cba1417d39b58db3f79
BLAKE2b-256 bbfb8549590f689f8d56fd7e4a9f9adc9f181480647c44f11e128ede4f63776c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.2.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4672bf097b16d9bf7249eff13f65dca36df50d281d723e91c81d85960ec02d72
MD5 8f1165633a8b4e5e9a10141c2815b91e
BLAKE2b-256 052075fbc52d579f7d406183a6abecdbf31f999f66f588d3669ce96b8290a8e0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.2.1-cp310-cp310-win32.whl
  • Upload date:
  • Size: 248.3 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.2.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 1d2c9ef3611ceedf1fd481957dc9602b4e9e2ce351e797d41d5c83fd0bc93bbb
MD5 e529767dbf67813285616637b1ebe7c2
BLAKE2b-256 2dda15dd7255a8ea01760679f282cb2f2fd56ff7d5ccfec0f3d8da97b6c6081f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.2.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 276.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.2.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 7d77b9f1b413ef2a5d8c36320c574588b756d23bbd88154405505beea4824628
MD5 0876b60221bb145cc7782b1c0f7c579f
BLAKE2b-256 389e37b95b8d84641d5e31529f026bf39c73c9ddeac2814697b7fcfd0dc11cf4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.2.1-cp39-cp39-win32.whl
  • Upload date:
  • Size: 248.4 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.2.1-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 112109d74e9d4609f8201891736f902e7e71587ac3394ef4204ee9b2eb1ca9d1
MD5 9e2f72de5d585e8f0f521cb1dc894890
BLAKE2b-256 faea78a49dd2bc26ee9cdd6e8efa86fbb810b6eb7452dff2690c8ba136f66ae9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.2.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 276.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.5.2.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 d43c65ece6d6630af950cd673ea79a0dd3d47605bd32dfc7b1ba9f1976ce72e6
MD5 01cfaa6e52453f1a156073baf9a2cdd0
BLAKE2b-256 528c5fb1b8323f13eb99ee271c6cf68dab2d424978e0448ab90e80bd87e99ad0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.2.1-cp38-cp38-win32.whl
  • Upload date:
  • Size: 248.4 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.2.1-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 c95138539645ba75b4a70f6b192d10857d4db3f1a9c8382f7ebd0729328429d8
MD5 33cb824de5f8050b572074f83846ece7
BLAKE2b-256 fb4c6054342c8fc4bfc33103f999b3f99e7574e58dd186d7bcfea6857bd3d650

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