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

鸣谢

特别感谢 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 Distribution

live2d_py-0.5.1.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.1-cp313-cp313-win_amd64.whl (275.4 kB view details)

Uploaded CPython 3.13Windows x86-64

live2d_py-0.5.1-cp313-cp313-win32.whl (247.7 kB view details)

Uploaded CPython 3.13Windows x86

live2d_py-0.5.1-cp313-cp313-macosx_14_0_universal2.whl (328.6 kB view details)

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

live2d_py-0.5.1-cp312-cp312-win_amd64.whl (275.4 kB view details)

Uploaded CPython 3.12Windows x86-64

live2d_py-0.5.1-cp312-cp312-win32.whl (247.7 kB view details)

Uploaded CPython 3.12Windows x86

live2d_py-0.5.1-cp312-cp312-macosx_14_0_universal2.whl (328.6 kB view details)

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

live2d_py-0.5.1-cp311-cp311-win_amd64.whl (275.4 kB view details)

Uploaded CPython 3.11Windows x86-64

live2d_py-0.5.1-cp311-cp311-win32.whl (247.6 kB view details)

Uploaded CPython 3.11Windows x86

live2d_py-0.5.1-cp311-cp311-macosx_14_0_universal2.whl (328.6 kB view details)

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

live2d_py-0.5.1-cp310-cp310-win_amd64.whl (275.4 kB view details)

Uploaded CPython 3.10Windows x86-64

live2d_py-0.5.1-cp310-cp310-win32.whl (247.6 kB view details)

Uploaded CPython 3.10Windows x86

live2d_py-0.5.1-cp39-cp39-win_amd64.whl (275.7 kB view details)

Uploaded CPython 3.9Windows x86-64

live2d_py-0.5.1-cp39-cp39-win32.whl (247.8 kB view details)

Uploaded CPython 3.9Windows x86

live2d_py-0.5.1-cp38-cp38-win_amd64.whl (275.7 kB view details)

Uploaded CPython 3.8Windows x86-64

live2d_py-0.5.1-cp38-cp38-win32.whl (247.8 kB view details)

Uploaded CPython 3.8Windows x86

File details

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

File metadata

  • Download URL: live2d_py-0.5.1.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.1.tar.gz
Algorithm Hash digest
SHA256 963272bfb7a9ec3d227542abfa2ce2a6f967b88938f3ddd50fdb64badc328852
MD5 f99e4e4629be6f7ef3e105bd95087b6a
BLAKE2b-256 84f406d1ad21a78c00964b5dd3cded87434acf0567f3e3868206f4103861450f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 275.4 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for live2d_py-0.5.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c38ced6af3222d7b3caebd98b5873b24ae0d2fcffb57ee1946fb66d579c30809
MD5 0fde8990bd5dc8dedb0fbf526feda1e5
BLAKE2b-256 488e40080a98c7378510a78e564ab4cf949106132322ea252b3b65e297554247

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.1-cp313-cp313-win32.whl
  • Upload date:
  • Size: 247.7 kB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for live2d_py-0.5.1-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 dbe0149fef168477b4f1f8cb8e18e5babcdfc7143b756323fed99486a1cb4203
MD5 ae791216a6f02ccbe1cc5b4246082ead
BLAKE2b-256 df4efdb824a4e843cf2b4af090d9a1333ca0f2a8c73afbb58376875094a0c071

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.1-cp313-cp313-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 53b20ce2fb6a3f7a94891372e60faa3a97b41255c270ad5eb40f1d601d54476f
MD5 c40b3f91ceddcf958654c4afa726069e
BLAKE2b-256 d6557589351c21bfc22ef4653465068bb5763322510928a2822ba17e4f4ce040

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 275.4 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.5.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3195aa36f350deb05093955753c2c407ce72b25a7bfa703db0c70f7194af3b21
MD5 d142484d697f840e80bd75401259d79b
BLAKE2b-256 5819bc9a15822fba455cdc1e65867140222b9e8a17588f798fc3096e47422506

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.1-cp312-cp312-win32.whl
  • Upload date:
  • Size: 247.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.5.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 af168c3ffa771a125a414664f94245f15fc4f62f1928b15765829d12c373dd94
MD5 b47b7ce80458094d0803ee0b9d9f958d
BLAKE2b-256 d0b055798a2026c2c83cf868f0ad6ea2c29aac8a42929ed86874d990140c0cbf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.1-cp312-cp312-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 81d84b8442ad67a9aea45a40161acd756feb31475984126af3071f2bcf3152a3
MD5 72e1f04d2b7455622574672185718dbd
BLAKE2b-256 cc3cfa2fbe4e99ef2fa07940167758fb96b1eb3c567aa211a15024ef846e8dac

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 275.4 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.5.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3b4c0dcf1bdb8d8e0883fc436f3739f7adf7e40b7a7000b4a33388c45f85c14c
MD5 1d56b4f43871a75def5ebff2def4633f
BLAKE2b-256 f6d57e53b50109bf4bbac73a4b9ac540b8ba54ba250d6cd801f4e4d6e5b2dcb2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.1-cp311-cp311-win32.whl
  • Upload date:
  • Size: 247.6 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.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 2cf6d313727bf0ee9fd8a7096ec2c39a170004810e6bb7b7a5bcfb582a052857
MD5 588a1f32aa6a627dcb5fe097e042dd98
BLAKE2b-256 22c9df05402ea4e063af245ce9b8b057d8957ec886145846110d53796c001bad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.1-cp311-cp311-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 b6b9013d7b25b196e542d98956e86f275efdfbf14352cf40c7ee61f3feac0530
MD5 5496a95ec8c5713699e3990fa63c25c4
BLAKE2b-256 f5ca9163e41f9c29b90c4352732f394b853e1f6bb588c7001576ede221f60236

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 275.4 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.5.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 edf813203f77243e6e34eea7dcced2d3023ed9e9f0e17558f9e728aa58e261fe
MD5 6feaede15ef3c031a722acacaaadc587
BLAKE2b-256 764ee90df3ef0dbf7292e1f9c774bb53ec4244fda0ee32591c09c35fc18c9ed6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.1-cp310-cp310-win32.whl
  • Upload date:
  • Size: 247.6 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.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 bb4f7f170ecc5a51bbf58e385272972da689181ca82b2e1026100567e0766d9f
MD5 ef75d69fe9698b8e8695ae8e0d3a6b06
BLAKE2b-256 8a2a648026f86cf4c9a987a348c4e224024292d4366d3149b8dbf1e12798faa1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 275.7 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.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 431dcce82af1f077b2c28692c8322b960481e89c7640f23d1a8098fd1724fab9
MD5 f0f43e0e0972ed3ab5dbb8e6a716eaac
BLAKE2b-256 563e98e6f7794cc8fc10bfb201b2d46d65edfe1f948c17cd27d338b034d32fbf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.1-cp39-cp39-win32.whl
  • Upload date:
  • Size: 247.8 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.1-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 e3ab5d09cd75ea6e006f4669207afbf1fa87d50af3cbc1d3ff6cf2b10e8bc2b0
MD5 d96e24d32bb6e12da66eba1285d7253a
BLAKE2b-256 22414d93360733f8aed5b466d667516eaa290637c8a0729a0d4c2f57758cd3f3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 275.7 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.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 c34f0bb8625826d9a94fb90a37f4f5df74e6cda609e6669bc608d35b6fbe3c30
MD5 d422b2635e55fcad5d1a30f19d2a426a
BLAKE2b-256 675e5d8eacb7d0f676ebbd641e55175d420ceaed38b74dd7cedad4d09cfef9f3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.1-cp38-cp38-win32.whl
  • Upload date:
  • Size: 247.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.5.1-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 24ee8203ddb67ee087d8039469ba6c97d23ba567c15638d35e23ac1147306972
MD5 d8717e56408ab926d145abdac74cde63
BLAKE2b-256 70db874652980ebbdd16f516801126af0a894294456627d4ce0dad103fc51412

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