错误信息
E:MyCode数据查看器DATA_VIEWER>pip install pyaudio
Collecting pyaudio
Using cached PyAudio-0.2.11.tar.gz (37 kB)
Using legacy setup.py install for pyaudio, since package 'wheel' is not installed.
Installing collected packages: pyaudio
Running setup.py install for pyaudio ... error
ERROR: Command errored out with exit status 1:
command: 'c:userszhuappdatalocalprogramspythonpython37python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\zhu\AppDa
ta\Local\Temp\pip-install-g0ipaimi\pyaudio\setup.py'"'"'; __file__='"'"'C:\Users\zhu\AppData\Local\Temp\pip-install-g0ipaimi\pyaudio\setup.py'"'"';
f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))'
install --record 'C:UserszhuAppDataLocalTemppip-record-mullvorlinstall-record.txt' --single-version-externally-managed --compile --install-headers 'c:u
serszhuappdatalocalprogramspythonpython37Includepyaudio'
cwd: C:UserszhuAppDataLocalTemppip-install-g0ipaimipyaudio
Complete output (9 lines):
running install
running build
running build_py
creating build
creating buildlib.win-amd64-3.7
copying srcpyaudio.py -> buildlib.win-amd64-3.7
running build_ext
building '_portaudio' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:userszhuappdatalocalprogramspythonpython37python.exe' -u -c 'import sys, setuptools, tokenize; sys.arg
v[0] = '"'"'C:\Users\zhu\AppData\Local\Temp\pip-install-g0ipaimi\pyaudio\setup.py'"'"'; __file__='"'"'C:\Users\zhu\AppData\Local\Temp\pip-install-
g0ipaimi\pyaudio\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(
code, __file__, '"'"'exec'"'"'))' install --record 'C:UserszhuAppDataLocalTemppip-record-mullvorlinstall-record.txt' --single-version-externally-managed
--compile --install-headers 'c:userszhuappdatalocalprogramspythonpython37Includepyaudio' Check the logs for full command output.
出现原因
在windows上没有python3.7的预构建包(轮子),有一个用于Python 2.7和3.4到3.6,因此需要在PC上准备构建环境以使用此包。因为有些软件包很难在Windows上构建,所以找到3.7的轮子更容易一些。
解决办法
下载你所需的轮子,根据你的python安装的版本,下载相匹配的轮子。
地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/
在该页面搜索你要的包的名字,然后点进去,选择相应的版本,下载下来,使用pip命令安装。