Skip to main content
 首页 » 编程设计

python之pyFluidsynth 'module' 对象没有属性 'Synth'

2024年11月01日8insus

我有两个 fluidsynth

sudo apt-get install fluidsynth 

和pyfluidsynth

sudo pip install pyfluidsynth 

已安装。

但是,当我运行标准导入命令时,出现以下错误:

>>> import fluidsynth 
>>> fs = fluidsynth.Synth() 
Traceback (most recent call last): 
  File "<stdin>", line 1, in <module> 
AttributeError: 'module' object has no attribute 'Synth' 

请您参考如下方法:

无论出于何种原因,似乎按照您的安装说明下载了 fluidsynth 0.2 版,而不是最新的 1.2.4 版。

要安装正确的包,请卸载 fluidsynth 并手动安装正确的包(来自 fluidsynth 的 pypi 页面的 tar.gz 文件):

pip uninstall pyfluidsynth 
pip install -Iv https://pypi.python.org/packages/source/p/pyFluidSynth/pyFluidSynth-1.2.4.tar.gz#md5=60079310701d0b9298b65a8b6728ffcc