[英]Getting error while installing pyaudio in windows 10
I am a beginner in python language.我是python语言的初学者。 I have written a test function in python for converting speech-to-text :我在 python 中编写了一个用于将语音转换为文本的测试函数:
def getAudioFromMicrophone():
r = sr.Recognizer()
with sr.Microphone() as source:
lets_talk.in_female_voice('I am ready for your next command')
r.pause_threshold=1
r.adjust_for_ambient_noise(source,duration=1)
return r.listen(source)
When I run it, it says :当我运行它时,它说:
File "D:/PycharmProjects/python-modules/jarvis/jarvis.py", line 5, in import pyaudio ModuleNotFoundError: No module named 'pyaudio'文件“D:/PycharmProjects/python-modules/jarvis/jarvis.py”,第 5 行,导入 pyaudio ModuleNotFoundError: No module named 'pyaudio'
So, I am trying to install pyaudio in my windows 10 which is again showing an error.所以,我试图在我的 Windows 10 中安装 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: started
Running setup.py install for pyaudio: finished with status 'error'
Complete output from command D:\softwares\python-compiler\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\username\\AppData\\Local\\Temp\\pycharm-packaging\\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\username\AppData\Local\Temp\pip-record-9qmland0\install-record.txt
--single-version-externally-managed --compile:
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
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
building '_portaudio' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMS_WIN64=1
-ID:\softwares\python-compiler\include -ID:\softwares\python-compiler\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcsrc/_portaudiomodule.c /Fobuild\temp.win-amd64-3.7\Release\src/_portaudiomodule.obj
_portaudiomodule.c
d:\softwares\python-compiler\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\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
Command "D:\softwares\python-compiler\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\username\\AppData\\Local\\Temp\\pycharm-packaging\\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\username\AppData\Local\Temp\pip-record-9qmland0\install-record.txt
--single-version-externally-managed --compile" failed with error code 1 in C:\Users\username\AppData\Local\Temp\pycharm-packaging\pyaudio\ You are using pip version 18.1, however version 19.0.2 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Any sort of help will be appreciated!任何形式的帮助将不胜感激!
This is a problem with Python 3.7 because there isn't a PyAudio wheel for this version of Python for pip to find.这是 Python 3.7 的问题,因为此版本的 Python 没有 PyAudio 轮供 pip 查找。 To solve this, download a wheel that fits your computer's specs from here .要解决此问题,请从此处下载适合您计算机规格的轮子。 Now, navigate to the folder the wheel was downloaded to in the command prompt and run: pip install (name of the .whl file here)
.现在,在命令提示符中导航到车轮下载到的文件夹并运行: pip install (name of the .whl file here)
。 This should work fine if you are on Windows and using Python 3.7.如果您使用的是 Windows 并使用 Python 3.7,这应该可以正常工作。
Try below commands to install the pyaudio
on "Windows 10".尝试使用以下命令在“Windows 10”上安装pyaudio
。
pip install pipwin
pipwin install pyaudio
Step1.第1步。 Download the PyAudio-0.2.11-cp310-cp310-win_amd64.whl from this link https://pypi.bartbroe.re/pyaudio从此链接下载PyAudio-0.2.11-cp310-cp310-win_amd64.whl https://pypi.bartbroe.re/pyaudio
Step2.第2步。 Use the following comand in cmd pip install (path to the file)/PyAudio-0.2.11-cp310-cp310-win_amd64.whl在 cmd pip install (path to the file)/PyAudio-0.2.11-cp310-cp310-win_amd64.whl 中使用以下命令
Now it will install in my case hope this will help you too.现在它将安装在我的情况下希望这也能帮助你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.