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

注意:本项目中使用到的Live2D Core模块,需要自行前往Live2D官网下载。同时,将暂时停止python build库的发布。

使用 Python 直接加载和操作 Live2D 模型,不通过 Web Engine 等间接手段进行渲染。

基于 Python C Extension 对 Live2D Native SDK (C++) 进行了封装。理论上,只要配置好 OpenGL 上下文,可在 Python 中将 live2d 绘制在任何基于 OpenGL 的窗口。

代码使用示例:examples

详细使用文档: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, GuangChen2333, makabakadot, thynetruly, mastwet, KyvYang, @Mozilla88, @CooperWang0912, @minghf85

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

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.6.0.1.tar.gz (455.3 kB 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.6.0.1-cp313-cp313-win_amd64.whl (293.6 kB view details)

Uploaded CPython 3.13Windows x86-64

live2d_py-0.6.0.1-cp313-cp313-win32.whl (266.0 kB view details)

Uploaded CPython 3.13Windows x86

live2d_py-0.6.0.1-cp313-cp313-macosx_15_0_universal2.whl (349.4 kB view details)

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

live2d_py-0.6.0.1-cp313-cp313-macosx_13_0_universal2.whl (375.4 kB view details)

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

live2d_py-0.6.0.1-cp312-cp312-win_amd64.whl (293.4 kB view details)

Uploaded CPython 3.12Windows x86-64

live2d_py-0.6.0.1-cp312-cp312-win32.whl (266.2 kB view details)

Uploaded CPython 3.12Windows x86

live2d_py-0.6.0.1-cp312-cp312-macosx_15_0_universal2.whl (349.2 kB view details)

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

live2d_py-0.6.0.1-cp312-cp312-macosx_13_0_universal2.whl (374.7 kB view details)

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

live2d_py-0.6.0.1-cp311-cp311-win_amd64.whl (293.4 kB view details)

Uploaded CPython 3.11Windows x86-64

live2d_py-0.6.0.1-cp311-cp311-win32.whl (266.2 kB view details)

Uploaded CPython 3.11Windows x86

live2d_py-0.6.0.1-cp311-cp311-macosx_15_0_universal2.whl (349.3 kB view details)

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

live2d_py-0.6.0.1-cp311-cp311-macosx_13_0_universal2.whl (374.7 kB view details)

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

live2d_py-0.6.0.1-cp310-cp310-win_amd64.whl (293.4 kB view details)

Uploaded CPython 3.10Windows x86-64

live2d_py-0.6.0.1-cp310-cp310-win32.whl (266.2 kB view details)

Uploaded CPython 3.10Windows x86

live2d_py-0.6.0.1-cp39-cp39-win_amd64.whl (293.8 kB view details)

Uploaded CPython 3.9Windows x86-64

live2d_py-0.6.0.1-cp39-cp39-win32.whl (266.1 kB view details)

Uploaded CPython 3.9Windows x86

live2d_py-0.6.0.1-cp38-cp38-win_amd64.whl (293.8 kB view details)

Uploaded CPython 3.8Windows x86-64

live2d_py-0.6.0.1-cp38-cp38-win32.whl (266.0 kB view details)

Uploaded CPython 3.8Windows x86

File details

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

File metadata

  • Download URL: live2d_py-0.6.0.1.tar.gz
  • Upload date:
  • Size: 455.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.10

File hashes

Hashes for live2d_py-0.6.0.1.tar.gz
Algorithm Hash digest
SHA256 9d676df407c20db6c34fe2ea90996ca627d4eff92359f715e574d8e51b305600
MD5 94f6a0c8696f273269e7c31254a927f0
BLAKE2b-256 9ce4a3ea26518463a6793d5915e18c9b42f49fc78125b57968449ab6a1b7cf2b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.6.0.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e65443d65c0d86c8296df90dab30914c1110e4473792b0ddf855e5eef5d562b3
MD5 cc4955a90912fb0ad61b8e8291501d7f
BLAKE2b-256 c002b1a8d39edb8e2ede9bf311ecb633ee6f9c7e8a8f66acf95703089d4ba073

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.6.0.1-cp313-cp313-win32.whl
  • Upload date:
  • Size: 266.0 kB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.10

File hashes

Hashes for live2d_py-0.6.0.1-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 0a1afce4e226dd8edd851b3cbaa91da5de65699d8bcdfc362fb3f49c56fd4660
MD5 55548c8a477b163fd8bd529635b00faa
BLAKE2b-256 6357664a71a81f9e899f6389325dfb8252acaed399e150cc7c9272f5d1ce53a8

See more details on using hashes here.

File details

Details for the file live2d_py-0.6.0.1-cp313-cp313-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for live2d_py-0.6.0.1-cp313-cp313-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 9ea9a5e9ba00f943d11d01220f4c94330ad0982fc517a0115ac84f267d441fa4
MD5 8c690baee7baf244d95f30eae80879ab
BLAKE2b-256 d126798ac51d4b0709e01846d3f87a7ca5e68188125827084f23eb3c309550a1

See more details on using hashes here.

File details

Details for the file live2d_py-0.6.0.1-cp313-cp313-macosx_13_0_universal2.whl.

File metadata

File hashes

Hashes for live2d_py-0.6.0.1-cp313-cp313-macosx_13_0_universal2.whl
Algorithm Hash digest
SHA256 122a0d164b7600e6e2e434f8078ae1e4b5d8df97243d2d3a0957acd979f90aa2
MD5 0812e94bf7d16e2d016cbfba81c3ed8f
BLAKE2b-256 67331fe043af079e6c1c938576be553d5a80747346f4e0218b23ee37adb5fadb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.6.0.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 96bea2a8b82b3ba7c6c521f1293303b96071338f4b3d2266328d7dc1770abe13
MD5 fdfde99c25fb981e529feda8781f798f
BLAKE2b-256 444de01e4538148b80d17e562d31109013eda9c74d7ec1451118af84b6bb96df

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.6.0.1-cp312-cp312-win32.whl
  • Upload date:
  • Size: 266.2 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for live2d_py-0.6.0.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 c7241928d3474be38ae013926f2c269a955c893238fa0ceb50ec1ce187f7d9db
MD5 9abb71223d506e08acf31b8046db0de7
BLAKE2b-256 77efb52ce04d26f0ce37d12dafcf7e4d0a2c7d2235a7d7a459154867c10cf016

See more details on using hashes here.

File details

Details for the file live2d_py-0.6.0.1-cp312-cp312-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for live2d_py-0.6.0.1-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 fa0841658d7f29636a1cc8b0398f22e064f0ee22fe80a17d22969dff653953d8
MD5 fcc5c616d3ad3b99557cf6a381f83dae
BLAKE2b-256 5a92bcf07c8b37d04f4c20c1e9e1bc2f088cbc1af39a2c6bfd4c389a92c896f0

See more details on using hashes here.

File details

Details for the file live2d_py-0.6.0.1-cp312-cp312-macosx_13_0_universal2.whl.

File metadata

File hashes

Hashes for live2d_py-0.6.0.1-cp312-cp312-macosx_13_0_universal2.whl
Algorithm Hash digest
SHA256 758a160776026e89f557bf31ddecc53cd550eae33b0766e34d253ff7b383520a
MD5 ef5f65ee3d70b18005bf177031ae079c
BLAKE2b-256 beec0ee754f80247f44d428b6ad4d7b943818953dd3151aef9badbb19d5d77d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.6.0.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4b5c262a1646262b4eb1ddc309a9c4ef22948bbbaab4163a8f326518f50684a5
MD5 1d1913f502500e79e2d58d39db35f908
BLAKE2b-256 55edcd10a001a5cbef785a27023aeb8c46fc0af38704c9a336b5e5898a3c5ac2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.6.0.1-cp311-cp311-win32.whl
  • Upload date:
  • Size: 266.2 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for live2d_py-0.6.0.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 d6cf1d4f0a60832839626e150817e38aeab03d2c3d5821d5d28d3de3c4740193
MD5 bca65931e3a6ba125dc0e2c9e436b293
BLAKE2b-256 d3877f7dac941b0957acaae0d54e140c55c56338cef668a55f7a97a7b6e4e9e9

See more details on using hashes here.

File details

Details for the file live2d_py-0.6.0.1-cp311-cp311-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for live2d_py-0.6.0.1-cp311-cp311-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 20b0dc4c49680cde5cce67b949fdd3fe719fc5668fe459773e6d412a6cb52eae
MD5 175539adc5078c741dda5b580b1d2c73
BLAKE2b-256 189e1b9334a81dce0ed8ed531ca42f5e4d833e18218b6be0a1fc90f59b1896a4

See more details on using hashes here.

File details

Details for the file live2d_py-0.6.0.1-cp311-cp311-macosx_13_0_universal2.whl.

File metadata

File hashes

Hashes for live2d_py-0.6.0.1-cp311-cp311-macosx_13_0_universal2.whl
Algorithm Hash digest
SHA256 dd9cfaf80f4be422353fcae8246fb669013537f973df0ef4f1a0d4f995dbfeea
MD5 eff0e2b0b4318c240c80da3a0c9e63ec
BLAKE2b-256 d529c305d685230c6b52b5dd41f23ace1c02223cde0fe0160d23188e2ae16b50

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.6.0.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 50cd2970f353fea5680e446ae811418f8b7e73c82644d7a63fbb06819a5aec68
MD5 6f93b17447c3abbdc5b709d5e120a0e8
BLAKE2b-256 fc82faaf32bfdfd31652204797bb4f008a6a7c09cdb90c0e74abd72e6d4ac9bf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.6.0.1-cp310-cp310-win32.whl
  • Upload date:
  • Size: 266.2 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for live2d_py-0.6.0.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 c710268647c15213212970c54b2c6562aa748e4aa27ab7a49af9f715e3420006
MD5 5bb469635341e057651b1b52f987e2d7
BLAKE2b-256 133d2353f21665de2e77c268243a36e247c59256a44a53a4f3c10a7070d364bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.6.0.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 293.8 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.0

File hashes

Hashes for live2d_py-0.6.0.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 05d48582329cb1749f9a92ae0a286c74c51c0fb0e6971ea17e8f7b96ab124640
MD5 4159db978cec80de771baf1f8155a0b4
BLAKE2b-256 fb6c0d336a9dedc8b72988cfe37e2fc7f584b915829e2f074ae8d9db66e45f9f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.6.0.1-cp39-cp39-win32.whl
  • Upload date:
  • Size: 266.1 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.0

File hashes

Hashes for live2d_py-0.6.0.1-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 66fcc6b8912671f0a573881b262f88b66347843c98f8097ed0074f9c4271a797
MD5 319bc602edadb2523b0c89278407654b
BLAKE2b-256 775744af8537d7582d148184111fd06be418119a8fea6eda831b72b85e7e4402

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.6.0.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 293.8 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.6.0.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 c691b4c76f05b9774119d267d90b3bc9fd466704dd6e49dbefe06b2eadc3517d
MD5 6b5844dd4f1468bb268383541ce5462b
BLAKE2b-256 82a8b9ce181b73365d9143289978ee5197cc3c752e3cf5e459f8326d53f8b955

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.6.0.1-cp38-cp38-win32.whl
  • Upload date:
  • Size: 266.0 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.6.0.1-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 938d804c4c9702b0e5302352fdacfc8ec4519643b9c8c5c6850e8d5f8216c4d8
MD5 34daf714cd118935b599170e18941f9c
BLAKE2b-256 8a6a09c9d337f238252c7c05dbac665790cdf048c7c9e0a584d2d8cbd560b185

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