在安装软件包时,我首先使用pip
,如果该方法不起作用,请尝试brew
,如果该方法不起作用,请尝试conda install
。但是我只使用了一次conda一次或两次,却忘记了如何使用它。我使用venv
作为虚拟环境,但我不愿意迁移到conda
,但是有时conda
可以安装pip
和brew
无法安装的软件包。我想让conda
将软件包安装到位于~/codes/venv/lib/python3.8/site-packages/
的venv目录中。这样,我继续使用我的venv虚拟环境,但是当我的其他两个软件包管理器发生故障时,还具有使用conda的额外优势。另外,我不愿意为了使用某个软件包而激活conda环境。这将导致事情变得比他们需要的复杂。我尝试使用此页面上的说明:
How to install packages into specific virtualenv created by conda
但是他们没有用。我把终端放在了
conda install -c anaconda pyaudio venv
尽管没有引发任何错误消息,但它没有完成任务。
有关pip安装PyAudio的错误的更多详细信息
Collecting PyAudio
Using cached https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz
Building wheels for collected packages: PyAudio
Building wheel for PyAudio (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Users/kylefoley/codes/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/vd/5ccxv4957f1_prjqt1l_ppsw0000gq/T/pip-install-0lbxa0yp/PyAudio/setup.py'"'"'; __file__='"'"'/private/var/folders/vd/5ccxv4957f1_prjqt1l_ppsw0000gq/T/pip-install-0lbxa0yp/PyAudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/vd/5ccxv4957f1_prjqt1l_ppsw0000gq/T/pip-wheel-h_c2hg7o --python-tag cp38
cwd: /private/var/folders/vd/5ccxv4957f1_prjqt1l_ppsw0000gq/T/pip-install-0lbxa0yp/PyAudio/
Complete output (16 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.8
copying src/pyaudio.py -> build/lib.macosx-10.9-x86_64-3.8
running build_ext
building '_portaudio' extension
creating build/temp.macosx-10.9-x86_64-3.8
creating build/temp.macosx-10.9-x86_64-3.8/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DMACOSX=1 -I/Users/kylefoley/codes/venv/include -I/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-3.8/src/_portaudiomodule.o
src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
^~~~~~~~~~~~~
1 error generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for PyAudio