python - 安装 PyAudio 时获取 "error: Microsoft Visual C++ 14.0 is required."

标签 python pip pyaudio

C:\Users\gabri\OneDrive\Desktop>pip3 install pyaudio
Collecting pyaudio
  Using cached https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz
Installing collected packages: pyaudio
    Running setup.py install for pyaudio ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\gabri\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\gabri\\AppData\\Local\\Temp\\pip-install-r9cgblze\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\gabri\\AppData\\Local\\Temp\\pip-install-r9cgblze\\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\gabri\AppData\Local\Temp\pip-record-032v86d_\install-record.txt' --single-version-externally-managed --compile --user --prefix=
         cwd: C:\Users\gabri\AppData\Local\Temp\pip-install-r9cgblze\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\gabri\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\gabri\\AppData\\Local\\Temp\\pip-install-r9cgblze\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\gabri\\AppData\\Local\\Temp\\pip-install-r9cgblze\\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\gabri\AppData\Local\Temp\pip-record-032v86d_\install-record.txt' --single-version-externally-managed --compile --user --prefix= Check the logs for full command output.

我的python版本:3.7.4,pip升级了。

我已经试过“python3.7 -m pip install PyAudio”,但还是不行。

我也尝试过从 .whl 安装它,但是当我运行命令时,会出现以下消息:

ERROR: PyAudio-0.2.11-cp34-cp34m-win32.whl is not a supported wheel on this platform."

我试过 32 位和 64 位。

最佳答案

目前,有与 Python 2.7、3.4、3.5 和 3.6 的官方发行版兼容的 wheel。

显然,该库没有适用于 Python 3.7 的版本,因此我会尝试降级 Python 版本。

在此站 pip 下载轮子:https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio .

选择:

  • PyAudio‑0.2.11‑cp37‑cp37m‑win32.whl 如果您使用 32 位
  • 适用于 64 位的 PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl

然后转到您的下载文件夹:

cd <your_donwload_path>
pip install PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl

关于python - 安装 PyAudio 时获取 "error: Microsoft Visual C++ 14.0 is required.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59467023/

相关文章:

python - 在 Python 中使用 Google App Engine 的 webapp2 开发 Web 应用程序

python - 如何在python中的另一个程序中添加类的方法的变量?

python-2.7 - pip 无法安装包,因为它找不到 swig2.0 二进制文件

python - pyaudio 中的破解声音正弦音调

带有麦克风输入的 Python Librosa

python - 从 LineStringField 中提取坐标

Python:从多个子进程异步打印标准输出

python - 在 Windows 64 位上安装 Scrapy 时遇到问题

python - 使用 pip 在 vi​​rtualenv 中更新 matplotlib

python - PyAudio——如何在单个流中捕获麦克风和系统声音?