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

Uploaded CPython 3.13Windows x86-64

live2d_py-0.5.3.2-cp313-cp313-win32.whl (250.4 kB view details)

Uploaded CPython 3.13Windows x86

live2d_py-0.5.3.2-cp313-cp313-macosx_14_0_universal2.whl (331.1 kB view details)

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

live2d_py-0.5.3.2-cp312-cp312-win_amd64.whl (278.1 kB view details)

Uploaded CPython 3.12Windows x86-64

live2d_py-0.5.3.2-cp312-cp312-win32.whl (250.4 kB view details)

Uploaded CPython 3.12Windows x86

live2d_py-0.5.3.2-cp312-cp312-macosx_14_0_universal2.whl (331.1 kB view details)

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

live2d_py-0.5.3.2-cp311-cp311-win_amd64.whl (278.2 kB view details)

Uploaded CPython 3.11Windows x86-64

live2d_py-0.5.3.2-cp311-cp311-win32.whl (250.4 kB view details)

Uploaded CPython 3.11Windows x86

live2d_py-0.5.3.2-cp311-cp311-macosx_14_0_universal2.whl (331.2 kB view details)

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

live2d_py-0.5.3.2-cp310-cp310-win_amd64.whl (278.2 kB view details)

Uploaded CPython 3.10Windows x86-64

live2d_py-0.5.3.2-cp310-cp310-win32.whl (250.4 kB view details)

Uploaded CPython 3.10Windows x86

live2d_py-0.5.3.2-cp39-cp39-win_amd64.whl (278.5 kB view details)

Uploaded CPython 3.9Windows x86-64

live2d_py-0.5.3.2-cp39-cp39-win32.whl (250.4 kB view details)

Uploaded CPython 3.9Windows x86

live2d_py-0.5.3.2-cp38-cp38-win_amd64.whl (278.5 kB view details)

Uploaded CPython 3.8Windows x86-64

live2d_py-0.5.3.2-cp38-cp38-win32.whl (250.4 kB view details)

Uploaded CPython 3.8Windows x86

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.2.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.2.tar.gz
Algorithm Hash digest
SHA256 3b2d9a276bb86d992dc37537b9bac7021da040a882b1b2e6c7cd37e987578d59
MD5 3284fb0aed6fdf516ea19ba8d2edad91
BLAKE2b-256 dad7f6d7fb4848613b3bc41d425b3ac9c4c2a01995abe7b76af73440623f73fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 cf0645d0f87fc5aa8be62fb4d18931e0d649202dc5561da2264545807653a662
MD5 43a11c3d9282659da061d56980f83465
BLAKE2b-256 8b27d824ad936ac3f1efb7d4b576d6143e25549ea62d2dea44791e95e537459a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.2-cp313-cp313-win32.whl
  • Upload date:
  • Size: 250.4 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.2-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 3f287af11d1359612f93ca204298037fe3a50a954cf39ecc1346d4d19ccdde88
MD5 bdd9fe1f5f1adffd0b5504c26294026d
BLAKE2b-256 901b1469ee3a611cae8312c8beb3de28b5effc61541a8b040ddb2d43b66cf486

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.2-cp313-cp313-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 440b3cbab1cfddff067794645099133a32b9700c0ca1b5fbf3c14b6191d36def
MD5 66926df04ad08c94165c52a7167dcf3a
BLAKE2b-256 45f80bfd1718899460fb3834c1a3c38a9ba3261af253777be37518296cd4dde9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4a0b0742c4368749a0f47c69a091cb65e6e71fdc19acfed5adf60b6950195b38
MD5 8f1bfd08eb1f47354308e96a8046d8aa
BLAKE2b-256 88f51a8104d2998439dcfba17a949427f41ec51e160ff6b6c644147aaf1704f7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.2-cp312-cp312-win32.whl
  • Upload date:
  • Size: 250.4 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.2-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 968045d080ba814e71bf8c7fd489bb34e466102c26ed4a520f530bbf7562b716
MD5 162958c18a948723ef42e30c12387d7a
BLAKE2b-256 fd36bce9c57dd912586c6d5ee89f02d02f1b8dd0e95a05b4df0bd39300748efd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.2-cp312-cp312-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 50654f3a1751b0d7002b13f0c1ddb9b405ed9a9070a2f49c884f495cc5d5bc31
MD5 b29f7e72988303981197c8e1cc7f20ca
BLAKE2b-256 657fbf49b2ac375ae08479df7d417a610532749e32c2ee314ba2bb907a67a230

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 32688705fce48378c43d342615e0eeabaeb41a1d77d0a1299515fb054b324cf9
MD5 151a3805fce8c8754c14f28ca138e770
BLAKE2b-256 9aea8fdf94ab03b9814addb0383f28f0128066e2713e839dd848d021adf656af

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.2-cp311-cp311-win32.whl
  • Upload date:
  • Size: 250.4 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.2-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 27b0ed075ed26dcb4643c493cc9d80d618d3134113f4d953d2b7ac64b75b4fd8
MD5 08ad09c710d0af5b446bdb6d33219b28
BLAKE2b-256 ba01de9548cdc70f596d87bf0e509a811d7f029ab108835ddc61e9854a2b283b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.2-cp311-cp311-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 2ccffe1621c8a2e7d112d1dd7575912a2dfb2516f026376a6d5151a079530dc2
MD5 725a8cb8ba539a5bf7a1f754dd4f0a7d
BLAKE2b-256 3f79c4bfdffb606759a564552452c77936faa46d773b6e855f5089c2359b6d97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.3.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 13a16804f19ca1b1ca44fc19cbeec900d2894276667ef166c4c395242a5e4df6
MD5 9261f8b73fbf4864a0e848041f6d1056
BLAKE2b-256 b675237e4d993c9c68e1699111755dfd557ebaae184e21d5d2499a8853cbb378

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.2-cp310-cp310-win32.whl
  • Upload date:
  • Size: 250.4 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.2-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 bfac5d9af7b66df455cf3f2dadc24e87417c9996647d1ef0247aed3c1256e420
MD5 116a447f2d5f8e154f495fdaf9ef9189
BLAKE2b-256 39a9d5ebc054b60c8c4c5b04fd3b6996901161e39703675b1efcad84a4ac2417

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 278.5 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.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ff93a6e2c2cf107d620d47d6a207fbaedac7503ed3c9fc1cc1f31d09efa03ca7
MD5 3335680f9688cdea187771da7338fbf0
BLAKE2b-256 4496798d9d78007467741aa21e5253e8db86b08c3dda129288c4da00be8bf482

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.2-cp39-cp39-win32.whl
  • Upload date:
  • Size: 250.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.3.2-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 32e1583b5ba7649a7ce6617517ab35f4a2b2f72698fe27da70bc33fcf14ec611
MD5 6b022538dbfeade108f3a6074efdd6e7
BLAKE2b-256 1f49aa1cd4bbf013ba95d8419f16bca4f22c262e29542b822325a6f31db153b8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 278.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.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 5a198f632b2217d50ea00de416584549d5722a7048d7852ef3255b403165db0b
MD5 faa1d05e4e108ca286ef1b89ca4796cd
BLAKE2b-256 2ec6c389312da5b48780cb1c2cba8eede1b5f0156f5281ff9d913febd068ce7f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.3.2-cp38-cp38-win32.whl
  • Upload date:
  • Size: 250.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.3.2-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 e2dc2194edc84a7298f429a796fbc862d2563cdcf8250276c2ab79a6f037c399
MD5 606084645dda55116cd0b96f1939cf0a
BLAKE2b-256 d143e7b99e6a8eef6926865ded6c40f9421a9385d57decfb6c0b53ae05156fe6

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