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

Uploaded CPython 3.12Windows x86-64

live2d_py-0.4.2-cp312-cp312-win32.whl (275.9 kB view details)

Uploaded CPython 3.12Windows x86

live2d_py-0.4.2-cp312-cp312-macosx_14_0_universal2.whl (506.5 kB view details)

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

live2d_py-0.4.2-cp311-cp311-win_amd64.whl (303.0 kB view details)

Uploaded CPython 3.11Windows x86-64

live2d_py-0.4.2-cp311-cp311-win32.whl (275.7 kB view details)

Uploaded CPython 3.11Windows x86

live2d_py-0.4.2-cp311-cp311-macosx_14_0_universal2.whl (506.5 kB view details)

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

live2d_py-0.4.2-cp310-cp310-win_amd64.whl (302.1 kB view details)

Uploaded CPython 3.10Windows x86-64

live2d_py-0.4.2-cp310-cp310-win32.whl (274.8 kB view details)

Uploaded CPython 3.10Windows x86

live2d_py-0.4.2-cp39-cp39-win_amd64.whl (302.3 kB view details)

Uploaded CPython 3.9Windows x86-64

live2d_py-0.4.2-cp39-cp39-win32.whl (274.6 kB view details)

Uploaded CPython 3.9Windows x86

live2d_py-0.4.2-cp38-cp38-win_amd64.whl (302.3 kB view details)

Uploaded CPython 3.8Windows x86-64

live2d_py-0.4.2-cp38-cp38-win32.whl (274.6 kB view details)

Uploaded CPython 3.8Windows x86

File details

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

File metadata

  • Download URL: live2d_py-0.4.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 303.0 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.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 cd82866490d5d0a6fe6efdc6c92ddcab60c4efe0be4907c151f509a7a6b1e220
MD5 180b89ca47b8a54bda36d70fb4d80ccd
BLAKE2b-256 3a5517b8f795048750e59a9cb1e80e43ff2d41876c13f7c3e9114f17f55a6575

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.2-cp312-cp312-win32.whl
  • Upload date:
  • Size: 275.9 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.2-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 ffa1b3c1423613f2204aaabe6291183317b0257638bd309a11bc9ad70762b520
MD5 c1b2836e90b9de94a283f0555f37e206
BLAKE2b-256 5e48cbbc03611e080257ccf836ffd031cfb14bee29e7559de4c65994e517303a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.2-cp312-cp312-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 83cd07cc2891e56d470506c63c5fe7433fbe2a6e81f223f773678c52e5cdb368
MD5 3b1c55763954ee1dbe6c2b2b8b43e24d
BLAKE2b-256 434c6047e8ab1e4b64341530e7eae24b01f38dc4bd583a971d1de31a40e3f87d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 303.0 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.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8eda755847b98060a4fa367d4ec57c5d9d6e1a67707d654f0cd9d55aede50a1b
MD5 d6a2476cf6c9c60b6de370f951141753
BLAKE2b-256 ef60d15ab953aac2624510ac2b415cbdd10124b5ad104a8cee4c267e73c98347

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.2-cp311-cp311-win32.whl
  • Upload date:
  • Size: 275.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.2-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 dfd7a74ea44a100cb92418d5aef6876f5c11c7573d662cda1a3ec9e50053caea
MD5 9d5437ab1514031a744de82dcb99b7ba
BLAKE2b-256 fdfff8f0087582813193852860b8410ee6135d34c0076f50eafa3eb14990b0b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.4.2-cp311-cp311-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 27fae47672c09866532e4c849dfe38c849cd8137bbf6df2864278261c858b9b3
MD5 1baedb2ffaf85672bf975cc298728146
BLAKE2b-256 efd71e827b95062e2980b74ddf09694ca02373d1a0c2d6ed93490360512d5a9a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 302.1 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.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 37138a9537bbbe731c73c8c5ae996eec380494855f4d9aba8c3ca62577eb83fc
MD5 1a01ea9c3d4e6b5fc6b5966173e9b74a
BLAKE2b-256 4f7365dc16b25859456cbf503eb9eb7d5d353c2b7e7e6bcf8944944576dbee50

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.2-cp310-cp310-win32.whl
  • Upload date:
  • Size: 274.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.2-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 5d9b415b3b5f2d74813f21a3649581be9bef9f525caea73cc35db6372576c6d0
MD5 cf1068bfb82df1e4c67f2a50ef563029
BLAKE2b-256 17b51476bb3942af7e90b0078dc75f4b6b9644ec078f596e5f571e1bda24b95b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 302.3 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.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 fa7d26ec83d341497eefa0bc171b8b58ec8c7663108b8ea2ab76b68a4e20be0b
MD5 95df24d0c1132999cc86f46bb4f837f9
BLAKE2b-256 7c0f3a442c46007b79ca97874c01b8c44927248bfdc3f127db087129d65a8f39

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.2-cp39-cp39-win32.whl
  • Upload date:
  • Size: 274.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.2-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 2e6b47ad469baf9a968d741629c593d88d3a55cbb4d94d96de264d69ab53bb05
MD5 cd2aa830f96b67688a6922ac35171a69
BLAKE2b-256 88e1a0712d7a4a73b8401037665a14b9c4f26760d15ef59e9a17d1f328aca01d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 302.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.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 e79b9fd04daf524ad89e3282dc93e78d0b4b36e0ff7abcb37b4f25daf76c250c
MD5 711021bf9885ef35bad7295beb607a65
BLAKE2b-256 71d685ceda95c6a045bf05981f0ee6e90d7076363f1bf96673bc3204587a6cfe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.4.2-cp38-cp38-win32.whl
  • Upload date:
  • Size: 274.6 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.2-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 a85f1dd9b512740392ca0b4d25e91ebe8eb8388118e2d635adfe783bccf9babe
MD5 db5478cc2d7ac1e1b04569058e2ebb0b
BLAKE2b-256 267fac95e9f114aee6cb8f88ef611295ff26a05c90321aaa5adf610000c8d7a5

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