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. 将仓库中的 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.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.4.5-cp313-cp313-win_amd64.whl (255.2 kB view details)

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

live2d_py-0.4.5-cp313-cp313-macosx_14_0_universal2.whl (303.0 kB view details)

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

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

live2d_py-0.4.5-cp312-cp312-macosx_14_0_universal2.whl (303.0 kB view details)

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

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

live2d_py-0.4.5-cp311-cp311-macosx_14_0_universal2.whl (303.0 kB view details)

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

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

live2d_py-0.4.5-cp39-cp39-win_amd64.whl (255.4 kB view details)

Uploaded CPython 3.9Windows x86-64

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

Uploaded CPython 3.9Windows x86

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

Uploaded CPython 3.8Windows x86-64

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

File metadata

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

File hashes

Hashes for live2d_py-0.4.5.tar.gz
Algorithm Hash digest
SHA256 f5102998422b7e9ab1578b3127e7d9e3ff81a7cfe2b8118ec4ad9873f5ea9de4
MD5 9c5a62c967fca9880f41b211176f7a44
BLAKE2b-256 12630f5696e86a06419d0f258e97fd8554fe105267af7e82ed06b14a720d93cd

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for live2d_py-0.4.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 fe087581c735997e6407190d7d68e2f25779e70dc5c232c2445c32b7dd682f93
MD5 5dab94fec30b650468b296afc9caafe0
BLAKE2b-256 d5405693eb36156e97f8a06ffa4004202dfb2402be4501353c29ce17de6062af

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.5-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-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 1a76beb3366715742800a0321bdf4a51d58673c0ff3598270a30c33d73223d3c
MD5 affeb0aabaaa77e8a01aa936a5295fec
BLAKE2b-256 b6e5d6e26202535f3904d9047ee8795116dc67c78298cf8f81c33e44db0cbb13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.5-cp313-cp313-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 963351ab4564764c0aa2300aaad98a19cd01399f2f5e15633a898865c842def6
MD5 0978a12be97d2f93bedbf23fec4a7ff1
BLAKE2b-256 76782f7ae9f559e58ed0b0b1f61c7489d4a85176744324059ec4e109701c9585

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.5-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 255.2 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.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a72b802f2e1440006dfbaf559d19cdded8249e6e501c5ef33cc1f0c03ad8fc81
MD5 b2b6fbcbc5ab3a659f81b352d63bc830
BLAKE2b-256 31e2e0b6f80a42c66e53059f712e220885f66db4f87dc4a7cee45c09bd52f151

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.5-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-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 5e5c60a11186f3b4170d10eb97784f0c03854477c992196b294595285162c601
MD5 3ac4109291c253a9daaea49097080838
BLAKE2b-256 5b8d8c7537304dc09719099c4a9ae7ef4403475d718ddc0e5f00614fae2d92fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.5-cp312-cp312-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 a7a5d34aca499b03b894d83b644d8fc2eb217f936dd4d611370d20cb38276501
MD5 0d90e6029c03182499c5612f4f494611
BLAKE2b-256 cb9a8f373fb71d5ba06c5f31de697eac356f2b1c1b9364577fa6c1ae92999dad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.5-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 255.2 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.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8ecf14d3856227a46e9a561efe781a58e9aa317ac9e5fd5d3d183966bf8ef404
MD5 1895b7aa89e4534aca3ebf5d661e3749
BLAKE2b-256 1d32e82129913fa7ff17245eb0aa1f2aa21357e49f3e35b92fd6a1392d544fe0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.5-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-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 5661443fb8ac83075f9b6d244572ee55b583d056130ced3f68e5cd8d847a72bf
MD5 4ff03681197add71e2e7fd9443bc3e3a
BLAKE2b-256 ca6c36c8cba6149402df9c5527c6816daa15037e45bbf7d32f039e43564bfaaa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.5-cp311-cp311-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 55aa5d822f24c4aba3e4a70c1745d534e6420be06881cd68639d60dc74088e82
MD5 bdeb955768f2fbbbd70209c59dfb05c2
BLAKE2b-256 a48f456078396116c9bd24bcbb15fbbc5570b262d1d9e908f204ae6880170c2d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.5-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 255.2 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.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4de4dd5c8651ae3ea9221abbff8739f25f0f81b82cddd238f4a671c0acaff0fa
MD5 22d6086b493105131b5413d5159bca29
BLAKE2b-256 2d3e9acd9f5ae90f71023523271af19701317164af65cafd48c84c92d23e5a7f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.5-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-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 bf71e49653ff565370d56e93d31ee3b83ba6907110bfce600b984b8d2f30b976
MD5 1fb5102f28e3708da41d9a7ddc39c1f3
BLAKE2b-256 362ced9b437f89fc54c5c5d0ea9fe5d03b9588d3a261d7484501665963e46075

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.5-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 255.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.4.5-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 bef1c78d2a82744cb906356bd81df531e5c6191cbe3e1ba47bdd539ccaf66f4a
MD5 4845ea49ec6fe8c6b674fdd07faf7b74
BLAKE2b-256 9b9081dd6382ba1dbaaa1cad0bd6a36e59ee4e0ba56cc6d47c58ee2801da68f5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.5-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-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 2529db8c4a1318665938f3f4be3c0ad4109c129fef9f7d12094afedbc3a35bb2
MD5 13638c75ba888df04ea6499fd80343af
BLAKE2b-256 d88de30469ef0541b3fa8e645ec22e50ca33ad2c4ad2f1159d2e58d3f0dfd95b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.5-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-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 156c6dad6ef6003f9ed8984c8872d16004c099bfb43e49918765149ac6ebdc4b
MD5 a66a5dde8080a1262586240837179a47
BLAKE2b-256 a608c55012bd3dd06db0c9174ec29422520435a648233369a66788e6f9bbf2ef

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.5-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-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 ec01f96c93141342763adbad6618435be7a57ea6f57ae0eb4cb9c301427a4e16
MD5 03a3dd9286cb88a44036c6f1b95442a4
BLAKE2b-256 b6b7f3a9e60810c730d88bf7b37ea445294385ac11b434a18c11b1f7de2404fb

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