简体   繁体   English

我无法在 Windows 10 中安装 Pyaudio

[英]I am not able to install Pyaudio in my windows 10

When I Write pip install pyaudio or -m pip install PyAudio Then it shows an error like bellow -当我写 pip install pyaudio 或 -m pip install PyAudio 然后它显示如下错误 -

ERROR: Command errored out with exit status 1:
     command: 'C:\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\SUDHAN~1\\AppData\\Local\\Temp\\pip-install-zern0h1s\\PyAudio\\setup.py'"'"'; __file__='"'"'C
:\\Users\\SUDHAN~1\\AppData\\Local\\Temp\\pip-install-zern0h1s\\PyAudio\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();ex
ec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\SUDHAN~1\AppData\Local\Temp\pip-record-b0h1w_j0\install-record.txt' --single-version-externally-managed --compile --install-headers
 'C:\python37\Include\PyAudio'
         cwd: C:\Users\SUDHAN~1\AppData\Local\Temp\pip-install-zern0h1s\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": http://landinghub.visualstudio.com/visual-cpp-build-tools
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\SUDHAN~1\\AppData\\Local\\Temp\\pip-install-zern0h1s\\PyAudi
o\\setup.py'"'"'; __file__='"'"'C:\\Users\\SUDHAN~1\\AppData\\Local\\Temp\\pip-install-zern0h1s\\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\SUDHAN~1\AppData\Local\Temp\pip-record-b0h1w_j0\install-record.txt' --single-version-externally-ma
naged --compile --install-headers 'C:\python37\Include\PyAudio' Check the logs for full command output.

Microsoft Visual C++ 14.0 is required.需要 Microsoft Visual C++ 14.0。 Get it with "Microsoft Visual C++ Build Tools使用“Microsoft Visual C++ Build Tools”获取

You need install MS VS here您需要在此处安装 MS VS

As the error says, install Microsoft Visual C++ 14.0 - it provides required build tools.正如错误所说,安装Microsoft Visual C++ 14.0 - 它提供了所需的构建工具。 You can download it from here .你可以从 这里下载。 Also, to avoid majority of such problems in future, make sure you have Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019 - install all of them.此外,为了避免将来出现大多数此类问题,请确保您拥有适用于 Visual Studio 2015、2017 和 2019 的 Microsoft Visual C++ Redistributable - 安装所有这些。

Download Visual Studio installer.下载 Visual Studio 安装程序。 After the installer is installed, launch it and go to the Workloads tab and select C++ build tools and install them.安装程序安装后,启动它并转到Workloads选项卡并选择 C++ 构建工具并安装它们。

在此处输入图片说明

After installing C++ build tools, try installing PyAudio in a new Command Prompt window.安装 C++ 构建工具后,尝试在新的命令提示符窗口中安装 PyAudio

Remember: install PyAudio in a new command prompt window after closing the previous window.请记住:关闭上一个窗口后,在新的命令提示符窗口中安装 PyAudio。

Step 1 : Download the Pyaudio from this website第 1 步:从该网站下载 Pyaudio

https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio

Depending on your python version取决于你的python版本

Step 2 : then open cmd on the same directory where pyaudio is downloaded第 2 步:然后在下载 pyaudio 的同一目录中打开 cmd

Step 3 : Then type this command: pip install pyaudiofilename第 3 步:然后输入以下命令: pip install pyaudiofilename

for example例如

pip install PyAudio-0.2.11-cp37-cp37m-win_amd64.whl

i hope it will work!我希望它会起作用!

i also tried all of these answers but none of these works!我也尝试了所有这些答案,但没有一个有效!

so i tried this solution and it worked!所以我尝试了这个解决方案,它奏效了!

Here is the ScreenShot!这是截图!

Before

在此处输入图片说明

After

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM