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

Uploaded CPython 3.13Windows x86-64

live2d_py-0.5.2-cp313-cp313-win32.whl (248.1 kB view details)

Uploaded CPython 3.13Windows x86

live2d_py-0.5.2-cp313-cp313-macosx_14_0_universal2.whl (329.3 kB view details)

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

live2d_py-0.5.2-cp312-cp312-win_amd64.whl (276.3 kB view details)

Uploaded CPython 3.12Windows x86-64

live2d_py-0.5.2-cp312-cp312-win32.whl (248.1 kB view details)

Uploaded CPython 3.12Windows x86

live2d_py-0.5.2-cp312-cp312-macosx_14_0_universal2.whl (329.3 kB view details)

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

live2d_py-0.5.2-cp311-cp311-win_amd64.whl (276.4 kB view details)

Uploaded CPython 3.11Windows x86-64

live2d_py-0.5.2-cp311-cp311-win32.whl (248.1 kB view details)

Uploaded CPython 3.11Windows x86

live2d_py-0.5.2-cp311-cp311-macosx_14_0_universal2.whl (329.3 kB view details)

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

live2d_py-0.5.2-cp310-cp310-win_amd64.whl (276.4 kB view details)

Uploaded CPython 3.10Windows x86-64

live2d_py-0.5.2-cp310-cp310-win32.whl (248.1 kB view details)

Uploaded CPython 3.10Windows x86

live2d_py-0.5.2-cp39-cp39-win_amd64.whl (276.7 kB view details)

Uploaded CPython 3.9Windows x86-64

live2d_py-0.5.2-cp39-cp39-win32.whl (248.4 kB view details)

Uploaded CPython 3.9Windows x86

live2d_py-0.5.2-cp38-cp38-win_amd64.whl (276.6 kB view details)

Uploaded CPython 3.8Windows x86-64

live2d_py-0.5.2-cp38-cp38-win32.whl (248.4 kB view details)

Uploaded CPython 3.8Windows x86

File details

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

File metadata

  • Download URL: live2d_py-0.5.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.2.tar.gz
Algorithm Hash digest
SHA256 f9af929d5779dc067c4670672d3b4501eed83d1420d48dfc57d31234959c41f8
MD5 59c7710a3c08a11af226b54b32cf178e
BLAKE2b-256 f08f8b0ee875a622bfc1e00ae634fe647b935cccafdc47e99b058391783c3196

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for live2d_py-0.5.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 fe6fde0d3bb4a03ab955821018396ee8abe61c519f8e2d3803ebdf1470241370
MD5 0062c9e7aa919b86907d5f7b18c26b82
BLAKE2b-256 f25e25bc5a95c8f75bb2d5ceccc570b398c3837ca31c86836946459e2a2af185

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.2-cp313-cp313-win32.whl
  • Upload date:
  • Size: 248.1 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.2-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 c6e6b8494778d2a1b7a33bd3f49d70ecd41963673114f4a2f73571e338ad74a3
MD5 454a1c507f09d1b7d5c09f8048ed21fe
BLAKE2b-256 2d346f97e4de20939c24828e647c3deef7ef16dba1f9b63a190a843b5fdf774f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.2-cp313-cp313-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 cf24c50ee0962325df309bc9bd2b775eb1cbc62d9880f6debfe27107eb0c6d35
MD5 44c7bf0962031bfb6300ab4ae1ea6e3f
BLAKE2b-256 90ceca03b665240f07aceab15bfbb67035822053beb03f8666f4b4df338907d2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 276.3 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.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5244ae4846e5fc3bafd4365a15539af92a7d0d0522930c45e46f69c5c60c7585
MD5 2ee77bab5c714520491322163ed6edac
BLAKE2b-256 568bfcb252443ca6a8ba89dbfd5cd6b235eb52796e32f352906dd9848c059de3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.2-cp312-cp312-win32.whl
  • Upload date:
  • Size: 248.1 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.2-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 dcdd6eec6afe2e276879bbb0bae25dae26173075f7e00517155f6676b6ee862d
MD5 fc9fe821fe389907f5fb4d14ba4b2c63
BLAKE2b-256 1a45a4ddeccf730f4379a1483fee295c6f9d8a06e987ee92e4b448b143f8aa3f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.2-cp312-cp312-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 7935b5945dd41caff8cb3df8374917abfd07275525e9d6c7f02e613ceaef5263
MD5 f44ef1d8c89654947304c0a99d414d8a
BLAKE2b-256 fb1957067d306011835fd054081a228a38fd06ef577d3bd826340b95def36103

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 276.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.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 babdb9bf99ca8e1fc6985371a795b8fb367d171d9d5abff081613b5c9dd910e3
MD5 f1b91c89aa85ebe8ce99c98685f5f316
BLAKE2b-256 a4bc93e989661e7de8a589e5651b08df0c425cc0095ee1ae00e114be9d5834a6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.2-cp311-cp311-win32.whl
  • Upload date:
  • Size: 248.1 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.2-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 f03648557edb8285d1521848a5a1ceaa4e0da831e510bda04fe77dbf540c4eb6
MD5 577530d75ea59b70c3a6437aa23cfbbb
BLAKE2b-256 c793546b6c50d9f5b53048d239f2bb7884ef7302d677ca4c1603ecc057a0bac8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for live2d_py-0.5.2-cp311-cp311-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 1d4eca6b49cb8ee5b0dbd0ecc06a5eb84a729ef53570166e00cd629d8ac09680
MD5 05d7570cbe6f149403e969f36a1dbc28
BLAKE2b-256 adee07c67f7c39a16ac0804470c0f176ca1cc6df55e23527def43513eea6fe90

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 276.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.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 74aff2474a8b23a0105747e43e59b6fc6316544f916e2c8edfd0402b7a0f1208
MD5 13c1d6958470ea71d4f87cac3498fe42
BLAKE2b-256 763c41c6f63e547d5bdfa77394bcb9f09c6cac70148709fb8205c5bf16f452e8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.2-cp310-cp310-win32.whl
  • Upload date:
  • Size: 248.1 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.2-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 f10eb0786a5012fb5f5278bfd89b67662b072b72a6c7890889cc2d0aac82719c
MD5 812fb278ebcac1f0d6eb8c496591a70a
BLAKE2b-256 dda7250082a16cc27419fd288ab3ea7cf1db2937a12a4cc9dfe052d40b722732

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 276.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.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 06685217545f1bc2c21a42106b4a7fa5fc19d034191f33759afad3717f79e5e4
MD5 2cb2d012e133c59a6bda80aa67d81879
BLAKE2b-256 36a4db1c48e4458e03e8c0e2ea0cebdca03242065407ceeb22bcfca4a3d23a5e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.2-cp39-cp39-win32.whl
  • Upload date:
  • Size: 248.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.2-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 4f07648536011fe9aac44407c708a51c63596cdfa2c6269dcb1693c9a728c89d
MD5 105682fcb1f72c6f20b4f8aff6867a09
BLAKE2b-256 3a0e7f86949087823dfa292caa589bf69d9c5159f5676c56b63efd4100b5bbf6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 276.6 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.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 ed9032aa9c9c2da672f8db7d9a7db4159f20b652807704ec963d1e58b728299f
MD5 beff2b74f2a682cc349c3e21a6669547
BLAKE2b-256 95b7950a666491ab0926f23d62efa9b09ada5f3f6d3b706c4a870a80612ea921

See more details on using hashes here.

File details

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

File metadata

  • Download URL: live2d_py-0.5.2-cp38-cp38-win32.whl
  • Upload date:
  • Size: 248.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.2-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 74ea1bb0f01ffbf519c3ae4f64a40d560538b7e21169c863bdb4cf481e629aa0
MD5 d7e06b215c889190d723f91375d3e5bc
BLAKE2b-256 2b9a3b16b38ca29f8351cb24988616a4a24a0a24d75adad3d48e4467e1e177a4

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