fix: 修复 Windows 平台中 Could not find Opus library 的问题#3105
Conversation
There was a problem hiding this comment.
Pull request overview
该 PR 旨在解决 Windows 11 环境下运行 app.py 时 opuslib_next 报 “Could not find Opus library” 的问题,通过在应用启动早期主动定位并加载项目内置的 Opus 动态库来避免导入失败。
Changes:
- 新增
utils/system_info.py:实现跨平台的 Opus 动态库查找、(可选)复制与加载逻辑,并对ctypes.util.find_library进行补丁。 - 新增
utils/finder.py/utils/constant.py:提供 libs 目录定位与项目根目录常量。 - 更新
app.py:在其他模块导入前调用setup_opus()以确保 Opus 库可用。
Reviewed changes
Copilot reviewed 4 out of 7 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| main/xiaozhi-server/utils/system_info.py | 增加 Opus 动态库查找/加载与 find_library 补丁逻辑 |
| main/xiaozhi-server/utils/finder.py | 增加 libs 目录定位辅助方法 |
| main/xiaozhi-server/utils/constant.py | 增加项目根目录 APP_DIR 常量 |
| main/xiaozhi-server/app.py | 启动时优先执行 setup_opus(),避免后续 opuslib_next 导入失败 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
已经对内容进行修改:
适配了日志输出: |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 5 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 5 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
chore: 删除多余的 LibPath 枚举
fix: 修复 opuslib 加载失败的问题
平台:Windows11
项目版本:0.9.2
问题描述:安装好 requirement.txt 内的依赖后,运行 app.py 文件显示找不到 opuslib。具体报错如下:
解决方案:通过在本地添加 opuslib 二进制文件,并在运行前进行加载即可解决此问题。