简体   繁体   English

无法在 Python 3.8 中安装 PyAudio

[英]Can't Install PyAudio in Python 3.8

I have an issue with PyAudio I Have installed PyAudio in Python 3.6 and Python 3.8 via Python unofficial libraries.我有 PyAudio 的问题 我已经通过 Python 非官方库在 Python 3.6 和 Python 3.8 安装了 PyAudio。

C:\Users\Baali>pip install --user PyAudio

Successfully installed PyAudio-0.2.11成功安装 PyAudio-0.2.11

But when I tried to import PyAudio it says:但是当我尝试导入 PyAudio 时,它说:

import PyAudio

Traceback (most recent call last):追溯(最近一次通话):
File "", line 1, in ModuleNotFoundError: No module named 'PyAudio'文件“”,第 1 行,在 ModuleNotFoundError 中:没有名为“PyAudio”的模块

For Windows OS run:对于 Windows 操作系统运行:

pip install pipwin
pipwin install pyaudio

For Linux OS run:对于 Linux 操作系统运行:

sudo apt-get install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0
pip install pyaudio --user

check this link for more info: https://www.codegrepper.com/code-examples/python/install+pyaudio+pip3+ubuntu查看此链接了解更多信息: https://www.codegrepper.com/code-examples/python/install+pyaudio+pip3+ubuntu

I don't know if this will make any difference but try installing pyaudio (all lowercase).我不知道这是否会有所不同,但请尝试安装 pyaudio(全部小写)。

pip install pyaudio


Update 1:更新 1:

I recreated your error and import pyaudio works but import PyAudio doesn't work.我重新创建了您的错误并且import pyaudio有效但import PyAudio无效。

在此处输入图像描述


Update 2:更新 2:

I extracted the following directions from this post:我从这篇文章中提取了以下说明:

ModuleNotFoundError: No module named 'pyaudio' (Windows) ModuleNotFoundError:没有名为“pyaudio”的模块 (Windows)

"General solution (for Windows) “通用解决方案(适用于 Windows)

The best thing is not to rely on your system PATH.最好不要依赖你的系统路径。 Use the py launcher to select the version you want.使用 py launcher 到 select 你想要的版本。 To run the pip module corresponding to the Python version you want to use, start pip as a module instead of executable.要运行与您要使用的 Python 版本相对应的 pip 模块,请将 pip 作为模块而不是可执行文件启动。 So instead of:所以不是:

pip install <package>

run (try 3.8 here instead of 3.6):运行(在这里尝试 3.8 而不是 3.6):

py -3.6 -m pip install <package>

To see which Python packages you have installed for that Python version, use:要查看您为该 Python 版本安装了哪些 Python 软件包,请使用:

py -3.6 -m pip freeze " py -3.6 -m pip freeze

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

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