首页 文章

如何安装PyAudio 0.2.11 Fedora

提问于
浏览
1

我想为Python使用SpeechRecognition库,但是当我尝试运行一个使用麦克风的程序时,我打算这样做,我得到了错误

“需要PyAudio 0.2.11或更高版本(找到版本0.2.9)”

所以我做了一些挖掘,并找到了如何使用apt-get安装它 . 不幸的是我运行Fedora 26,所以我必须使用yum来安装我的软件包,当我找到使用它安装PyAudio的方法时,我只能找到版本0.2.9 .

每当我尝试做的时候

pip安装pyaudio

我收到以下错误:

pyaudio构建轮失败运行setup.py clean for pyaudio无法构建pyaudio安装收集的软件包:pyaudio运行setup.py install for pyaudio ... error从命令/ usr / bin / python2 -u -c完成输出“import setuptools ,tokenize; file ='/ tmp / pip-build-ZiuxD3 / 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 /tmp/pip-a2Iwxv-record/install-record.txt - -single-version-external-managed --compile:运行安装运行构建运行build_py创建构建创建build / lib.linux-x86_64-2.7复制src / pyaudio.py - > build / lib.linux-x86_64-2.7运行build_ext构建'_portaudio'扩展创建build / temp.linux-x86_64-2.7创建build / temp.linux-x86_64-2.7 / src gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Werror = format-security - Wp,-D_FORTIFY_SOURCE = 2 -fexceptions -fstack-protector-strong --param = ssp-buffer-size = 4 -grecord-gcc-switches -specs = / usr / lib / rpm / redhat / redhat-hardened-cc1 -m64 -mtune = generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Werror = format-security -Wp,-D_FORTIFY_SOURCE = 2 -fexceptions -fstack-protector-strong --param = ssp-buffer-size = 4 -grecord-gcc-switches -specs = / usr / lib / rpm / redhat / redhat-hardened-cc1 -m64 -mtune = generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I / usr / include / python2.7 -c src / _portaudiomodule.c -o build / temp.linux-x86_64-2.7 / src / _portaudiomodule.o gcc:error:/ usr / lib / rpm / redhat / redhat-hardened-cc1:没有这样的文件或目录错误:命令'gcc'失败,退出状态为1

----------------------------------------

命令“/ usr / bin / python2 -u -c”import setuptools,tokenize; file ='/ tmp / pip-build-ZiuxD3 / pyaudio / setup.py'; f = getattr(tokenize,'open',open) (file); code = f.read() . replace('\ r \ n','\ n'); f.close(); exec(compile(code,file,'exec'))“install - 记录/tmp/pip-a2Iwxv-record/install-record.txt --single-version-external-managed --compile“失败,错误代码1在/ tmp / pip-build-ZiuxD3 / pyaudio /

1 回答

  • 4

    你需要:

    sudo dnf install portaudio-devel redhat-rpm-config
    

    接下来,您可以安装pyaudio .

    pip install --user pyaudio
    

    注意:

    • yum已弃用,请改用dnf .

    • 当您看到有关程序的编译/构建时,请始终检查您是否具有像package_name-devel这样的devel依赖项 .

    • 在fedora上使用pip安装时,请始终使用--user . 它将在您的家中安装包 . 否则,您可以与dnf包创建冲突 .

相关问题