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

时间:2013-11-16 18:34:37

标签: python audio fluidsynth

我有两个fluidynth

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'

2 个答案:

答案 0 :(得分:2)

无论出于何种原因,似乎按照您的安装说明下载了fluidynth版本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

答案 1 :(得分:0)

我在安装fluidsynth时也遇到了这个问题。我在 Windows 中遵循以下步骤:

  • 安装pyfluidsynth:pip install git+https://github.com/0xf0f/pyfluidsynth
  • 转到安装fluidsynth的路径:例如:C:\ProgramData\Anaconda3\Lib\site-packages并打开fluidsynth.py文件。
  • 在写 fluidsynth.pylib = find_library('fluidsynth') 行中添加 find_library('libfluidsynth64')
  • 现在下载libfluidsynth64.dll并将其粘贴到您安装fluidsynth的路径中:例如:C:\ProgramData\Anaconda3\Lib\site-packages

您可以通过在 Anaconda Prompt 中运行 pythonimport fluidsynthfuidsynth.Synth() 来测试它是否有效。