我从https://pypi.python.org/pypi/PyAudio下载了PyAudio 0.2.11tar文件,并运行以下命令:
sudo python setup.py install
我得到以下错误:
running install
Checking .pth file support in /usr/local/lib/python3.5/dist-packages/
/usr/bin/python3 -E -c pass
TEST PASSED: /usr/local/lib/python3.5/dist-packages/ appears to support .pth files
running bdist_egg
running egg_info
writing top-level names to src/PyAudio.egg-info/top_level.txt
writing src/PyAudio.egg-info/PKG-INFO
writing dependency_links to src/PyAudio.egg-info/dependency_links.txt
reading manifest file 'src/PyAudio.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'src/PyAudio.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
building '_portaudio' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.5/src/_portaudiomodule.o
src/_portaudiomodule.c:28:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
如何成功安装?
我甚至尝试过这个“git克隆https://people.csail.mit.edu/hubert/git/pyaudio.git”,但在编译时显示以下错误:
src/_portaudiomodule.c:28:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
为了编译,我使用了这个命令:sudo python3 setup.py install
这对我有效:
在https://pypi.python.org/pypi/PyAudio#downloads中下载PyAudio-0.2.11.tar.gz(md5) 并提取文件。
cd PyAudio-0.2.11
sudo python setup.py安装
你看起来:
Python 第一个软件需求是Python2.6、2.7或Python3.3+。这是使用库所必需的。
PyAudio(适用于麦克风用户) 如果且仅当您要使用麦克风输入(麦克风),则需要PyAudio。PyAudio版本0.2.11+是必需的,因为早期版本在某些情况下从麦克风录制时存在已知的内存管理错误。
如果未安装,库中的所有内容仍将工作,除非尝试实例化麦克风对象将引发AttributeRor。
PyAudio网站上的安装说明非常好-为了方便起见,总结如下:
在Windows上,使用Pip:execute
pip install pyaudio
在终端中安装PyAudio。在Debian派生的Linux发行版(比如Ubuntu和Mint)上,使用APT:execute
sudo apt-get install python-pyaudio python3-pyaudio
在终端中安装PyAudio。 如果存储库中的版本太旧,请使用Pip安装最新版本:executesudo apt-get install portaudio19-dev python-all-dev python3-all-dev && sudo pip install pyaudio
(如果使用Python 3,请将pip
替换为pip3
)。在OS X上,使用自制程序安装PortAudio:
brew install portaudio
。然后,使用Pip:pip install pyaudio
安装PyAudio。在其他基于POSIX的系统上,使用您选择的包管理器安装portaudio19 dev和python all dev(或者python3 all dev,如果使用python3)包(或者它们的最类似的包),然后使用Pip:
pip install pyaudio
安装PyAudio(如果使用python3,则将pip
替换为pip3
)。为了方便起见,在存储库根目录的第三方/目录下包含了用于Windows和Linux上常见64位Python版本的PyAudio wheel包。要安装,只需在存储库根目录中运行
pip install wheel
,然后运行pip install ./third-party/WHEEL_FILENAME
(如果使用Python 3,则将pip
替换为pip3
)。相关问题 更多 >
编程相关推荐