【问题标题】:Error installing pyaudio from PyCharm on OSX在 OSX 上从 PyCharm 安装 pyaudio 时出错
【发布时间】:2022-01-15 22:00:40
【问题描述】:

尝试通过 PyCharm 在 OSX 上安装此软件包时出现错误。找不到解决办法,希望有人给点建议。

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: started
Running setup.py install for PyAudio: finished with status 'error'

ERROR: Command errored out with exit status 1:
 command: /usr/local/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/r8/_5x4wg2j36l8zrdh1ql_2vrh0000gn/T/pip-install-mgmh8bxy/pyaudio_b6de439398d54d48abcfffdaaf01cc38/setup.py'"'"'; __file__='"'"'/private/var/folders/r8/_5x4wg2j36l8zrdh1ql_2vrh0000gn/T/pip-install-mgmh8bxy/pyaudio_b6de439398d54d48abcfffdaaf01cc38/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/r8/_5x4wg2j36l8zrdh1ql_2vrh0000gn/T/pip-record-j0kk4n9l/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/PyAudio
     cwd: /private/var/folders/r8/_5x4wg2j36l8zrdh1ql_2vrh0000gn/T/pip-install-mgmh8bxy/pyaudio_b6de439398d54d48abcfffdaaf01cc38/
Complete output (18 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.9
copying src/pyaudio.py -> build/lib.macosx-10.9-x86_64-3.9
warning: build_py: byte-compiling is disabled, skipping.

running build_ext
building '_portaudio' extension
creating build/temp.macosx-10.9-x86_64-3.9
creating build/temp.macosx-10.9-x86_64-3.9/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DMACOSX=1 -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-3.9/src/_portaudiomodule.o
src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
         ^~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/gcc' failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/r8/_5x4wg2j36l8zrdh1ql_2vrh0000gn/T/pip-install-mgmh8bxy/pyaudio_b6de439398d54d48abcfffdaaf01cc38/setup.py'"'"'; __file__='"'"'/private/var/folders/r8/_5x4wg2j36l8zrdh1ql_2vrh0000gn/T/pip-install-mgmh8bxy/pyaudio_b6de439398d54d48abcfffdaaf01cc38/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/r8/_5x4wg2j36l8zrdh1ql_2vrh0000gn/T/pip-record-j0kk4n9l/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/PyAudio Check the logs for full command output.
WARNING: You are using pip version 21.1.3; however, version 21.3.1 is available.
You should consider upgrading via the '/usr/local/bin/python3.9 -m pip install --upgrade pip' command.

Omnizart 也会出现同样的错误:(

【问题讨论】:

    标签: python pycharm package


    【解决方案1】:

    最后一个PyAudio 版本是在2017 年,它没有wheels for Python 3.9,这意味着您的安装过程并不简单——必须在本地机器上编译C 代码。不幸的是,编译过程失败,因为您缺少依赖项,即portaudio。需要安装,见相关问题when installing pyaudio, pip cannot find portaudio.h in /usr/local/include

    说到omnizart - 不确定你会得到哪个错误,我很怀疑它是关于portaudio。首先 - 确保按照omnizart repo: https://github.com/Music-and-Culture-Technology-Lab/omnizart/issues/29#issuecomment-877557801 中的建议安装所有依赖项。

    【讨论】:

      猜你喜欢
      • 2022-10-07
      • 1970-01-01
      • 1970-01-01
      • 2017-02-26
      • 2016-10-23
      • 2021-06-29
      • 1970-01-01
      • 2014-12-21
      • 2011-08-11
      相关资源
      最近更新 更多