Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在windows 10中安装pyaudio时出错_Python_Python 3.x_Speech Recognition_Speech To Text - Fatal编程技术网

Python 在windows 10中安装pyaudio时出错

Python 在windows 10中安装pyaudio时出错,python,python-3.x,speech-recognition,speech-to-text,Python,Python 3.x,Speech Recognition,Speech To Text,我是python语言的初学者。我用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_

我是python语言的初学者。我用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)
当我运行它时,它会说:

文件D:/PycharmProjects/python modules/jarvis/jarvis.py,第5行, 在里面 导入pyaudio模块NotFoundError:没有名为“pyaudio”的模块

因此,我正在尝试在我的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.

任何形式的帮助都将不胜感激

这是Python3.7的一个问题,因为这个版本的Python没有PyAudio控制盘供pip查找。要解决此问题,请从下载一个符合计算机规格的控制盘。现在,在命令提示符中导航到下载控制盘的文件夹,并在此处运行.whl文件的:pip install name。如果您在Windows上并使用Python3.7,这应该可以正常工作


我是从post获得此信息的。

尝试以下命令在Windows 10上安装pyaudio


你退房了吗?您是否使用pip install PyAudio来安装模块?@MatthewSmith我尝试使用pip install PyAudio来安装PyAudio,它说要求已经满足:PyAudio位于d:\softwares\python-3.5.3\lib\site packages 0.2.11,这意味着您已经安装了模块。但是,看起来好像您已将软件包安装在USB等外部设备上。是这样吗?我只是说,因为消息说模块安装在D:驱动器上…如果您在Linux上,您应该能够通过简单的sudo apt get install portaudio摆脱,在Mac上,您应该能够运行brew install portaudio,并且正常的pip安装应该可以工作。我尝试了这个命令,但不幸的是它不起作用,已满足要求:PyAudio==0.2.11file:///C:/Users/username/Desktop/PyAudio-d:\softwares\python-3.5.3\lib\site packages 0.2.11中的0.2.11-cp35-cp35m-win_amd64.whl。另外,我的python版本说是python 3.5.3。好吧,似乎安装了PyAudio,所以我不知道为什么会出现此错误。您有32位Python还是32位Windows?没有,64位Python和Windows都有
 pip install pipwin
 pipwin install pyaudio