我无法在 Windows 上安装 pyaudio?如何解决“错误:需要 Microsoft Visual C++ 14.0"? [英] I can't install pyaudio on Windows? How to solve "error: Microsoft Visual C++ 14.0 is required."?
本文介绍了我无法在 Windows 上安装 pyaudio?如何解决“错误:需要 Microsoft Visual C++ 14.0"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一台 Windows 10 PC,我想安装 pyaudio 以将它与我的聊天机器人一起使用,由 chatterbot 提供支持.
我尝试了 2 种不同的方式来安装 pyaudio.
第一种方法是在命令提示符下执行此操作:
python -m pip install PyAudio
结果如下:
C:\Users\Waaberi>python -m pip install PyAudio收集 PyAudio使用缓存 https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz安装收集的包:PyAudio为 PyAudio 运行 setup.py install ... 错误命令 C:\Users\Waaberi\AppData\Local\Programs\Python\Python37-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Waaberi\\AppData 的完整输出\\Local\\Temp\\pip-install-e5le61j0\\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\Waaberi\AppData\Local\Temp\pip-record-adj3zivl\install-record.txt --single-version-externally-managed --compile:运行安装运行构建运行 build_py创建构建创建 build\lib.win32-3.7复制 src\pyaudio.py ->构建\lib.win32-3.7运行 build_ext构建_portaudio"扩展错误:需要 Microsoft Visual C++ 14.0.使用Microsoft Visual C++ 构建工具"获取它:http://landinghub.visualstudio.com/visual-cpp-build-tools---------------------------命令 "C:\Users\Waaberi\AppData\Local\Programs\Python\Python37-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Waaberi\\AppData\\Local\\Temp\\pip-install-e5le61j0\\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\Waaberi\AppData\Local\Temp\pip-record-adj3zivl\install-record.txt --single-version-externally-managed --compile" 失败,错误代码 1 在 C:\Users\Waaberi\AppData\Local\Temp\pip-install-e5le61j0\PyAudio\
第二种方式是输入这个命令:
python pip install python-pyaudio
它什么都不做.
解决方案
,例如我的是PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl
,然后下载.
cd C:\Users\foobar\Downloads
pip
安装 .whl
文件,例如在我的情况下:pip install PyAudio-0.2.11-cp37-cp37m-win_amd64.whl
I have a Windows 10 PC and I want to install pyaudio to use it with my chatbot, powered by chatterbot.
I tried 2 different ways to install pyaudio.
The first way is doing this on the command prompt:
python -m pip install PyAudio
This is the result:
C:\Users\Waaberi>python -m pip 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
Complete output from command C:\Users\Waaberi\AppData\Local\Programs\Python\Python37-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Waaberi\\AppData\\Local\\Temp\\pip-install-e5le61j0\\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\Waaberi\AppData\Local\Temp\pip-record-adj3zivl\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
copying src\pyaudio.py -> build\lib.win32-3.7
running build_ext
building '_portaudio' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
----------------------------------------
Command "C:\Users\Waaberi\AppData\Local\Programs\Python\Python37-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Waaberi\\AppData\\Local\\Temp\\pip-install-e5le61j0\\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\Waaberi\AppData\Local\Temp\pip-record-adj3zivl\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Waaberi\AppData\Local\Temp\pip-install-e5le61j0\PyAudio\
The second way is entering this command:
python pip install python-pyaudio
and it does nothing.
解决方案
The answer by Agalin is already great and I just want to explain it in a step by step format for a novice like myself:
- find your Python version by
python --version
mine is3.7.3
for example - the easiest way to check either you have 64 or 32 Python just open it in the terminal:
- find the appropriate
.whl
file from here, for example mine isPyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl
, and download it. - go to the folder where it is downloaded for example
cd C:\Users\foobar\Downloads
- install the
.whl
file withpip
for example in my case:
pip install PyAudio-0.2.11-cp37-cp37m-win_amd64.whl
这篇关于我无法在 Windows 上安装 pyaudio?如何解决“错误:需要 Microsoft Visual C++ 14.0"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文