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命令安裝。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM