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

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

CubismNativeSamples (live2d.v3)

Cubism2 Web SDK (live2d.v2)

JsConvert (JavascriptPython 工具)

D2Evil (moc 文件分析)

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.1-cp312-cp312-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.12Windows x86-64

live2d_py-0.4.1-cp312-cp312-win32.whl (1.6 MB view details)

Uploaded CPython 3.12Windows x86

live2d_py-0.4.1-cp312-cp312-macosx_14_0_universal2.whl (723.1 kB view details)

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

live2d_py-0.4.1-cp312-cp312-macosx_10_9_universal2.whl (1.6 MB view details)

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

live2d_py-0.4.1-cp311-cp311-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.11Windows x86-64

live2d_py-0.4.1-cp311-cp311-win32.whl (1.6 MB view details)

Uploaded CPython 3.11Windows x86

live2d_py-0.4.1-cp311-cp311-macosx_14_0_universal2.whl (723.1 kB view details)

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

live2d_py-0.4.1-cp311-cp311-macosx_10_9_universal2.whl (1.6 MB view details)

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

live2d_py-0.4.1-cp310-cp310-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.10Windows x86-64

live2d_py-0.4.1-cp310-cp310-win32.whl (1.6 MB view details)

Uploaded CPython 3.10Windows x86

live2d_py-0.4.1-cp39-cp39-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.9Windows x86-64

live2d_py-0.4.1-cp39-cp39-win32.whl (1.6 MB view details)

Uploaded CPython 3.9Windows x86

live2d_py-0.4.1-cp38-cp38-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.8Windows x86-64

live2d_py-0.4.1-cp38-cp38-win32.whl (1.6 MB view details)

Uploaded CPython 3.8Windows x86

File details

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

File metadata

  • Download URL: live2d_py-0.4.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • 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.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 84939ffef7082f098ab834861661ae0ec8feda8274f24c97be73b34217b7b547
MD5 34a9a46df5c9c9cc5481c4d55dd2c97f
BLAKE2b-256 1dcafe83354dcdae37a64d7dbfd17d047a1783245458bbc82d51e3ab60119a6d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.1-cp312-cp312-win32.whl
  • Upload date:
  • Size: 1.6 MB
  • 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.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 d6cd30994a2a4807511674a44d41afea34e8b9348b620da389737e2ec88c5af7
MD5 2c789cc0d8492406c5d4a119145b3bf7
BLAKE2b-256 8a6222c524d6a365107ca0c4ad5bd100e7095a442214aba24509129c78a696ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.1-cp312-cp312-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 bcac2f553f8f2dad0a5dece9e87dda09ae6560943dc098a75ba98d251323976e
MD5 c697133ef4f6e32f0494494db234fd28
BLAKE2b-256 bdb54baa4043c0c38085ddcff25fa44b7dab000774b8820ccf034dc5f7921bb4

See more details on using hashes here.

File details

Details for the file live2d_py-0.4.1-cp312-cp312-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for live2d_py-0.4.1-cp312-cp312-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 11c92a9452b6e4f3dc5ac23842168853852b8d1521cdc4390d6ed9f93debc01f
MD5 a455ed95c403591f13bf568e788d1949
BLAKE2b-256 bf4775340f8910d4cdb1223ef9ed141eba7381cd415e730e6c52c4d05a610086

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • 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.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b8b15a44cc5ca511fd9973ed1e96340830b16b52fbfd83a4eaf1b01323b8fb36
MD5 ea776927a7109e0ed44ad12751a03ef0
BLAKE2b-256 7134ad6e5ba6d438f589674025da8f5026faf0d8d6060891e064629c09f77ddc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.1-cp311-cp311-win32.whl
  • Upload date:
  • Size: 1.6 MB
  • 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.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 710e381ff60b078abd980b376ba69c46db8be84892c418618876aec04875ca8c
MD5 53d7ad234fd2ab0ae68daafc87f14101
BLAKE2b-256 01b6189a6c1f3686e65b9b5ae1d1e7ba6f07fa50f21fd6a95e598c3464ce24dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.1-cp311-cp311-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 41e3e19008b29a8b47129aa120fdf67738d7a17f1810fe817f0074aa09085ccf
MD5 fb9f43da8c7534d2c4e943123f487ef2
BLAKE2b-256 2996a5f4414e768b32bcf7689c9a4798a81a8120f2a7f030c62de3b6e9f12c34

See more details on using hashes here.

File details

Details for the file live2d_py-0.4.1-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for live2d_py-0.4.1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 6bf04daebae5349dc897a85d269ad8a5bfcce29b795f56cd0db4d36309714fa9
MD5 a4c38cb3fe8ed7e968ab4e1cc6adb15f
BLAKE2b-256 0f064a5cbcf75c454a0ab3d201f86289cd2f462b5d76067ab5dba60585516694

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • 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.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ea023edb50aa95505f654a7f0c9933068695ddc7872e295bc595507c83211967
MD5 bc151d5a997bd7510b5c05844f008e23
BLAKE2b-256 962f55a9172ed26ca96bc456b5f8ac123dfb7fb91d040a37e386fcbf39396fa0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.1-cp310-cp310-win32.whl
  • Upload date:
  • Size: 1.6 MB
  • 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.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 98925fb2e225e53e703387ba36e281b7054e1db2cb60e020a5a9c56f2e6d7af6
MD5 adb85018d75b7c018c118e00e7d2b35e
BLAKE2b-256 1597800335b95d3a4be8671c0cdd836c824064c87e835cfed9632c711f370d4a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • 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.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f362eaa381d238ac4669a15698680d74e6c423f3d69500e7b5f88bc6e5ef553f
MD5 3a6be2e83de807895c09a4f29da26acd
BLAKE2b-256 005251d43392dfaa427dea8c45658e5e7359591c87c3146530c0198d39a19442

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.1-cp39-cp39-win32.whl
  • Upload date:
  • Size: 1.6 MB
  • 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.1-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 39ad9951de5db28b226df10e47b9525996baa88114b9e01b62f58a5781bcb312
MD5 79fc45d1aea206f40ff2d46b06a86097
BLAKE2b-256 f7e98a42d12186152e987d23b3bb2d5cae5c838c1ba293b01e2a1404f22f9deb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • 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.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 d83fbe2c3898d17785533b57d6b5f28456a3c548c8465aeba2691827acf3ff6d
MD5 dc90bd58db6f79c530d7072e6caf933a
BLAKE2b-256 e10690fbeceac5533ba894355206642e7f8bcfe35ebf7f65c602f9309dbcc960

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.1-cp38-cp38-win32.whl
  • Upload date:
  • Size: 1.6 MB
  • 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.1-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 e3f8d561b235510c4122c00db3da38c4f8af3079f82cf6c9973fe3e221db5b03
MD5 5e2e21e98d9d3c599aa79d38741c64e0
BLAKE2b-256 68125d27ff3dc3e1361f212b8bc0d5ab1713f2feca66197b00e8452a75f319b3

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