我有一台 Windows 10 电脑,我想安装 pyaudio 以将其与我的聊天机器人一起使用,由 chatterbot 提供支持。
我尝试了两种不同的方法来安装 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
但它什么也没做。
The 阿加林的回答 https://stackoverflow.com/a/52284344/4999991已经很棒了,我只想为像我这样的新手一步一步地解释它:
- 找到你的Python版本
python --version
我的是3.7.3
例如
- 检查你有 64 位还是 32 位 Python 的最简单方法只需在终端中打开它:
- 找到合适的
.whl
文件来自here https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio,例如我的是PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl
,然后下载。
- 例如,转到下载的文件夹
cd C:\Users\foobar\Downloads
- 安装
.whl
文件与pip
例如我的例子:
pip install PyAudio-0.2.11-cp37-cp37m-win_amd64.whl
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)