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.3.3.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.3-cp313-cp313-win_amd64.whl (281.2 kB view details)

Uploaded CPython 3.13Windows x86-64

live2d_py-0.5.3.3-cp313-cp313-win32.whl (253.5 kB view details)

Uploaded CPython 3.13Windows x86

live2d_py-0.5.3.3-cp313-cp313-macosx_14_0_universal2.whl (334.2 kB view details)

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

live2d_py-0.5.3.3-cp312-cp312-win_amd64.whl (281.2 kB view details)

Uploaded CPython 3.12Windows x86-64

live2d_py-0.5.3.3-cp312-cp312-win32.whl (253.5 kB view details)

Uploaded CPython 3.12Windows x86

live2d_py-0.5.3.3-cp312-cp312-macosx_14_0_universal2.whl (334.2 kB view details)

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

live2d_py-0.5.3.3-cp311-cp311-win_amd64.whl (281.3 kB view details)

Uploaded CPython 3.11Windows x86-64

live2d_py-0.5.3.3-cp311-cp311-win32.whl (253.5 kB view details)

Uploaded CPython 3.11Windows x86

live2d_py-0.5.3.3-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.3-cp310-cp310-win_amd64.whl (281.3 kB view details)

Uploaded CPython 3.10Windows x86-64

live2d_py-0.5.3.3-cp310-cp310-win32.whl (253.5 kB view details)

Uploaded CPython 3.10Windows x86

live2d_py-0.5.3.3-cp39-cp39-win_amd64.whl (281.6 kB view details)

Uploaded CPython 3.9Windows x86-64

live2d_py-0.5.3.3-cp39-cp39-win32.whl (253.5 kB view details)

Uploaded CPython 3.9Windows x86

live2d_py-0.5.3.3-cp38-cp38-win_amd64.whl (281.5 kB view details)

Uploaded CPython 3.8Windows x86-64

live2d_py-0.5.3.3-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.3.tar.gz.

File metadata

  • Download URL: live2d_py-0.5.3.3.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.3.tar.gz
Algorithm Hash digest
SHA256 27af2cfe9600eb77c5275a7aa81c7525525f8be68fb5eaa0fa5bf230c3240e02
MD5 b521659a4a0c884ce1f9d5c8026ddb06
BLAKE2b-256 3f54ffb0a84f7427fe46b2cfc6edac572084e4f3d49c11428a788de746b69a62

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 66b742d7babdca5987c8bf35e2178f3ff2a8d08c09b88d3590236826804cd935
MD5 976b740c30dd8daffbf8defdacd7516e
BLAKE2b-256 a851b74aeb34e918238273c40eae66111fa782c63ce0d0ff44773da4b11831e0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.3-cp313-cp313-win32.whl
  • Upload date:
  • Size: 253.5 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.3-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 c200a5eea1be12ab394621dbd4f088c07505eb137a8e539a9f612d42bb759a19
MD5 72040070ccbf02a5477081edae3f12a4
BLAKE2b-256 ab78c8b17d4c5d1ecb383cbbfe0545c6afd733335a69acf6c2855beeb2b940e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.3-cp313-cp313-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 8d4593c76c131bf72b9c43248f17ee1450b5a98a9324a0d6aac90fd6bd37209a
MD5 16b460f213e764a37081b2b2e924a21c
BLAKE2b-256 30e1832eaa362c6873baf72b3fcbdb6431d2774fea8932ea7bbcd325a9c94e98

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e01b7a04a6534d76c97de47c435380c2a4f251b06d3fcf17fb9a3954554f3253
MD5 f31c0fb956707c52a74ddf343095915e
BLAKE2b-256 495cef6397628462da7b09aab5329fb79747a448eb11bd1fcf22863713e1cd7c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.3-cp312-cp312-win32.whl
  • Upload date:
  • Size: 253.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.3-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 d59e96c013f9edccf821ae4a74f125a3fd7c71a361d1baa6b6e0d61c63cd87d3
MD5 227933328f2aa56623c3dcc7d7fb77a1
BLAKE2b-256 ec1f64b1cab5632c029e0ae65378328273b5f17921d612a36b1e1f15df4952e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.3-cp312-cp312-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 1077e32bb8444a64ce2f0572966530c7953952ebe5e54b3df52ed77c320bc74f
MD5 434920d5624075a7c3c710e3deb0913e
BLAKE2b-256 21f9fc13d20a49de677accbc899fcd83e1dcdd914659df653a014a26da49e28e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 091bcdf460537e1b21c3b16d2ad29514fb3ed95150b330a4e95b4f138ff3e7f9
MD5 ac43cf983960fde411dfee90a175648f
BLAKE2b-256 91f1b78cccfe29f4a5d4ca602df18588fe3e0cefb5abc572d450ce64e0ad5888

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.3-cp311-cp311-win32.whl
  • Upload date:
  • Size: 253.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.3-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 98325da9277c95d4a10d3130cce41a880b3a77c1a6dfd11507a28d8b03d4829c
MD5 62fddfcef7af1db7ecc58848b8941da3
BLAKE2b-256 9bc49fba2397ff0116e86998fdf4f2701664911a79e212579f18335660fa99fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.3-cp311-cp311-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 c2bf7cc0cd8fed424d63af796d8e357624dc8041b41060f713128cebff8e0e43
MD5 77b16a394c091e9a883c4abb3068a9a7
BLAKE2b-256 39bd33eef04e74bf3b0b26902e9240f92aa38a4ab6e85c797837078a4ad6d6af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1c80847fbc1e1b97608c6c0b18292718442cfe83981966c640768f691a641742
MD5 fb754e8f5c0fd3d7898c40cb3e1e8f53
BLAKE2b-256 566533daab055a3a1219f490079bce8f0bb11940e29fa91156bbae9c75a5ed9c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.3-cp310-cp310-win32.whl
  • Upload date:
  • Size: 253.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.3-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 8ea487f94c6bd3367c89ca02f183b3f5e125c5b3632ed64571b69b29aeaeac34
MD5 20b56f7d9eab41062eff39a1eb88622f
BLAKE2b-256 4686a7ef3a582cefd84360cdf38ba291ceb700fe579dce9baedb2f23969313c4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.3-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 281.6 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.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 40da9fa858ffb3d7679b192b26f573415f339359afa0f06e324b410d11bac934
MD5 a2e2dcc2ad36214963ebdee97d71a5f2
BLAKE2b-256 219d82867e57a77ed334d58c9e6432a7e7b1e86bb77c8b9ba9fc5cc531732a36

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.3-cp39-cp39-win32.whl
  • Upload date:
  • Size: 253.5 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.3-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 6e093e46d8cc34888f596141abb14ecbeeb38c92d7da4ce45b477b0c88f6dc23
MD5 d8c5fad84fe8cb31a125d8c0c66a096b
BLAKE2b-256 6267276858b0ed0175135140248de02b50c1320526c3bd64b3985dbeebcd3e77

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.3-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 281.5 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.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 64394bcad2080a383c1abd50e88ff54ed8233446b10aecc76f7d1e0b92158a77
MD5 4edf256fc4fcd2a141dd42dddb690f71
BLAKE2b-256 c3b75dd564559d926d4da91d1fe60dd5a01cd98b1875d7a11419a557f327db39

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.3-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.3-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 8a9c543e8cb42221c95a916bc83b0c6d11d73a21f2b93984044b50d2f77bed5b
MD5 be7b600563bba158261e55fd517882f5
BLAKE2b-256 219645ea2672b48cccc38fe9d30713960f2d4c4734c1676492aaa2296eca7a1f

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