【发布时间】:2018-12-08 16:37:10
【问题描述】:
我一直在使用一个使用sounddevice 模块播放音频的python 程序。该程序在我的办公室电脑(运行 Ubuntu 17.10)中运行良好,但在我的家用电脑(运行 Linux Mint 18.3)中运行良好。它会产生以下错误:
Traceback (most recent call last):
File "...path/to/my/code.py", line 11, in <module>
import sounddevice as sd
File "/home/arif/anaconda3/lib/python3.6/site-packages/sounddevice.py", line 64, in <module>
raise OSError('PortAudio library not found')
OSError: PortAudio library not found
我该如何解决这个问题?
【问题讨论】:
-
您安装了 PortAudio 吗?见the documentation。
-
@Matthias 是的,一切都已相应安装。我刚刚注意到,我的脚本在 Jupyter Notebook 上运行,但不在 PyCharm 上。
-
sounddevice模块执行此操作:from ctypes.util import find_library; find_library('portaudio')。如果这返回None,则会出现您的错误。 -
我也这么认为。你能指出它返回
None的任何原因吗? -
如果您认为,您应该在更新的问题中提及它。至于为什么它可能会返回
None,请参阅docs。