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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded CPython 3.12Windows x86-64

live2d_py-0.4.4.1-cp312-cp312-win32.whl (231.7 kB view details)

Uploaded CPython 3.12Windows x86

live2d_py-0.4.4.1-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.1-cp311-cp311-win_amd64.whl (255.8 kB view details)

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

live2d_py-0.4.4.1-cp311-cp311-macosx_14_0_universal2.whl (303.6 kB view details)

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

live2d_py-0.4.4.1-cp310-cp310-win_amd64.whl (254.9 kB view details)

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

live2d_py-0.4.4.1-cp39-cp39-win_amd64.whl (255.1 kB view details)

Uploaded CPython 3.9Windows x86-64

live2d_py-0.4.4.1-cp39-cp39-win32.whl (230.6 kB view details)

Uploaded CPython 3.9Windows x86

live2d_py-0.4.4.1-cp38-cp38-win_amd64.whl (255.1 kB view details)

Uploaded CPython 3.8Windows x86-64

live2d_py-0.4.4.1-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.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for live2d_py-0.4.4.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d5bade595179f5be009341ac4e858faad6afe1ba015833532e3ea052c0617fbc
MD5 7d2d02da1e0593b2d97e90442b994a5a
BLAKE2b-256 a780e3ca37e12750426bcb71522241297c19b5e35667877548f123e7ac4cb1e9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.4.1-cp312-cp312-win32.whl
  • Upload date:
  • Size: 231.7 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.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 363c3992525113dac3c96b9a180f31d0698c9ead1a8e580c94d6dccc86fca10b
MD5 a7c784418dd14b7d5dd250d8599e9f0a
BLAKE2b-256 e7b1a0914024aae8e87a3235ba5a8d3ef1987131178c021b39ffae828bbe5560

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.4.1-cp312-cp312-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 09721f9d8b7473d45c67040c41ef92c4078770577eed6c42e68788d6e4b139c9
MD5 2a4dac8a9ca39211352505bc74deaaf0
BLAKE2b-256 c9d9829da298d59163a5e1aab7d3655bcec1cf2ff7c8c9874b7748ab8500bae3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.4.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f364501bbe58622a537fa0d243d8829a025c1e6def8a5fbf316eb6f770f186f0
MD5 091769424b609c24f96397b5312b2e49
BLAKE2b-256 b114cb697ab23fa1de7127e282f186823997126358de56515ca6b5b363bd6697

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.4.1-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.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 00f48311519d96875506a822777e4265c84068589e320bb6a92dde202b42a095
MD5 961e3bbafe63983246e12c8a4f84a2cd
BLAKE2b-256 9dafb290df2c848e83ec261a56f1d01731389db4872e987a4976ce8070edb377

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.4.1-cp311-cp311-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 b2d5898164c4f49fbe74c93a0d85f7d3bee0618de40edcca41f77815e07bc997
MD5 e072df3b903197fb1fa8d3a1beb818bd
BLAKE2b-256 e1fe8bbc65a36021c2ea1155be8f757d42b00a672219ad5a6f3af285dd2f1c8e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.4.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 dc4e65ea3c457568fdd7a61de9e0f67972c6c9a8fe0771b34eb089ed7cf9a6a4
MD5 f1417757eb24ffe9d01e0ec7ea34493d
BLAKE2b-256 ffd903ce2d0ff07fde818481e81c877540bc6cdef4b5ad87dbf8ed3e6d602a83

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.4.1-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.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 bf1d7447cf5ed97d461728677d4704d2b0c3ccbdc37ca6a9f8a856a0ef26c388
MD5 60896d973d534d18dd0d15a90326e5c7
BLAKE2b-256 aaeec05ca83b2893903dea282512dc05cfb3af729b966ebd301360ccaa836fa2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.4.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 255.1 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.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 3993eb563269b76d53e0fba26c8eb2383687ee9ba5f01d749df78272908cd871
MD5 45eb5a789389cb99c7c76f228a490432
BLAKE2b-256 bb3ea88e6b57bd5913cd5b7c6242d929ca884baf678549bee7f58a64f981957c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.4.1-cp39-cp39-win32.whl
  • Upload date:
  • Size: 230.6 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.1-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 25b9976263098473013c4f602faf0d1c0212442d78be6347714459229eaf5f4c
MD5 e797d736059ac74d0ba1f040ebf20148
BLAKE2b-256 665d1a8986749b6c1b259f5b86ca05f0575a02ae3c7bc645af37e40045c5ea3e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.4.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 255.1 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.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 4e3a32d790669da7f0ad3148f55c6e7d357f5f112408555e029eb42b1ef4f560
MD5 d8c2e18a643fbd1663f3973dadd91f11
BLAKE2b-256 80e921faaecbe8d5f0cf9ac27f68fffb2682fd6e55732dc668b9563f0ca5d1b7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.4.1-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.1-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 aec4503555c032a8c38ed4d2d4ee7763a02909539fccfc103e0511ee5cbc09ff
MD5 6a01bbef0b2edfc1f7b4a0b721de15ec
BLAKE2b-256 b90005ebc4de2bd1fbe665bb03a3f35982a95f2c273b5658044923e8d2cf356f

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