Open WangLaoShi opened 4 weeks ago
我在代码中是这么实现的:
modules/api/impl/tts_api.py
try:
# OSError: cannot load library '/*****_soundfile_data/libsndfile.dylib'
import soundfile as sf
except:
import os
import platform
# 获取当前系统名称
system = platform.system()
if system == 'Darwin':
# 获取当前的DYLD_LIBRARY_PATH
current_dyld_library_path = os.environ.get('DYLD_LIBRARY_PATH', '')
# 要追加的路径
new_dyld_library_path = '/opt/homebrew/lib'
# 设置新的DYLD_LIBRARY_PATH,如果已存在则追加,否则设置为新值
if current_dyld_library_path:
os.environ['DYLD_LIBRARY_PATH'] = f"{new_dyld_library_path}:{current_dyld_library_path}"
else:
os.environ['DYLD_LIBRARY_PATH'] = new_dyld_library_path
# 输出验证
print(os.environ['DYLD_LIBRARY_PATH'])
import soundfile as sf
阅读 README.md 和 dependencies.md
检索 issue 和 discussion
检查 Forge 版本
你的issues
错误如下:
解决方案:
按照 dependencies.md 中的步骤,无法实现。
可以参考https://github.com/bastibe/python-soundfile/ 实现。