我有一台 Windows 10 PC,我想安装 pyaudio 以将它与我的聊天机器人一起使用,由 chatterbot 提供支持。
我尝试了 2 种不同的方式来安装 pyaudio。
第一种方法是在命令提示符下执行此操作:
python -m pip install PyAudio
这是结果:
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\
第二种方法是输入这个命令:
python pip install python-pyaudio
它什么也不做。
原文由 Waaberi Ibrahim 发布,翻译遵循 CC BY-SA 4.0 许可协议
Agalin 的回答 已经很好了,我只想为像我这样的新手一步一步地解释它:
python --version
我的是3.7.3
例如.whl
文件,例如我的是PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl
,然后下载。cd C:\Users\foobar\Downloads
.whl
文件pip
例如在我的例子中: