我有两个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'
答案 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 中遵循以下步骤:
pip install git+https://github.com/0xf0f/pyfluidsynth
C:\ProgramData\Anaconda3\Lib\site-packages
并打开fluidsynth.py
文件。fluidsynth.py
的 lib = find_library('fluidsynth')
行中添加 find_library('libfluidsynth64')
C:\ProgramData\Anaconda3\Lib\site-packages
您可以通过在 Anaconda Prompt 中运行 python
、import fluidsynth
和 fuidsynth.Synth()
来测试它是否有效。