Loading

python无法安装pyaudio模块

错误信息

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:\users\zhu\appdata\local\programs\python\python37\python.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('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))'
 install --record 'C:\Users\zhu\AppData\Local\Temp\pip-record-mullvorl\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\u
sers\zhu\appdata\local\programs\python\python37\Include\pyaudio'
         cwd: C:\Users\zhu\AppData\Local\Temp\pip-install-g0ipaimi\pyaudio\
    Complete output (9 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    copying src\pyaudio.py -> build\lib.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:\users\zhu\appdata\local\programs\python\python37\python.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('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(
code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\zhu\AppData\Local\Temp\pip-record-mullvorl\install-record.txt' --single-version-externally-managed
--compile --install-headers 'c:\users\zhu\appdata\local\programs\python\python37\Include\pyaudio' 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命令安装。

posted @ 2020-07-21 09:00  开花的马铃薯  阅读(831)  评论(0编辑  收藏  举报