简体   繁体   中英

Trying to pip install module but getting ERROR

I'm trying to pip install PyAudio in a venv to use it in tandem with the SpeechRecognition module. Any chance you know a quick fix to my error message?

ERROR: Command errored out with exit status 1

Or is this a deeper problem? And feel free to let me know if this is a stupid question! By the way, I've tried pip install PyAudio in my cmd as administrator, too. Same error. And I'm not too keen on downloading an older version of Python (I'm using 3.9.0) as some would suggest.

Here's my full error message, if that helps (I'm not sure what to look at, but you might):

Collecting pyaudio
  Using cached PyAudio-0.2.11.tar.gz (37 kB)
Using legacy 'setup.py install' for pyaudio, since package 'wheel' is not installed.
Installing collected packages: pyaudio
    Running setup.py install for pyaudio ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\Ethan\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Ethan\\AppData\\Local\\Temp\\pip-install-aydn66pc\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\Ethan\\AppData\\Local\\Temp\\pip-install-aydn66pc\\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\Ethan\AppData\Local\Temp\pip-record-otzyi04l\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\Ethan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Include\pyaudio'
         cwd: C:\Users\Ethan\AppData\Local\Temp\pip-install-aydn66pc\pyaudio\
    Complete output (17 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.8
    copying src\pyaudio.py -> build\lib.win-amd64-3.8
    running build_ext
    building '_portaudio' extension
    creating build\temp.win-amd64-3.8
    creating build\temp.win-amd64-3.8\Release
    creating build\temp.win-amd64-3.8\Release\src
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMS_WIN64=1 "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/_portaudiomodule.c /Fobuild\temp.win-amd64-3.8\Release\src/_portaudiomodule.obj
    _portaudiomodule.c
    C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\include\pyconfig.h(117): warning C4005: 'MS_WIN64': macro redefinition
    src/_portaudiomodule.c: note: see previous definition of 'MS_WIN64'
    src/_portaudiomodule.c(29): fatal error C1083: Cannot open include file: 'portaudio.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\Ethan\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Ethan\\AppData\\Local\\Temp\\pip-install-aydn66pc\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\Ethan\\AppData\\Local\\Temp\\pip-install-aydn66pc\\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\Ethan\AppData\Local\Temp\pip-record-otzyi04l\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\Ethan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Include\pyaudio' Check the logs for full command output.

Thanks!

A simple solution to all these errors which occur with pip is that you manually download them from https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio

procedure:

  1. lets say you have installed it in your downloads folder , you have to open your terminal there using the cd command eg: cd Downloads/
  2. then type pip install <name of the .whl file>

done this can be used for other modules too

pip install pipwin

pipwin install pyaudio

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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