当我尝试运行命令pip install simpleaudio
时,这就是它在终端中返回的内容:
Collecting simpleaudio
Using cached simpleaudio-1.0.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/rm/1wlhdbc15tq591by9qnr4_180000gn/T/pip-build-3N7xxl/simpleaudio/setup.py", line 40, in <module>
encoding='utf-8') as f:
TypeError: 'encoding' is an invalid keyword argument for this function
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/rm/1wlhdbc15tq591by9qnr4_180000gn/T/pip-build-3N7xxl/simpleaudio/
如果我尝试使用python3 -m pip install simpleaudio
安装它,我会得到以下输出:
Collecting simpleaudio
Using cached simpleaudio-1.0.1.tar.gz
Installing collected packages: simpleaudio
Running setup.py install for simpleaudio ... error
Complete output from command /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/rm/1wlhdbc15tq591by9qnr4_180000gn/T/pip-build-1201y9fs/simpleaudio/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/rm/1wlhdbc15tq591by9qnr4_180000gn/T/pip-yguvrnt6-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.6-intel-3.6
creating build/lib.macosx-10.6-intel-3.6/simpleaudio
copying simpleaudio/__init__.py -> build/lib.macosx-10.6-intel-3.6/simpleaudio
copying simpleaudio/shiny.py -> build/lib.macosx-10.6-intel-3.6/simpleaudio
copying simpleaudio/functionchecks.py -> build/lib.macosx-10.6-intel-3.6/simpleaudio
creating build/lib.macosx-10.6-intel-3.6/simpleaudio/test_audio
copying simpleaudio/test_audio/c.wav -> build/lib.macosx-10.6-intel-3.6/simpleaudio/test_audio
copying simpleaudio/test_audio/e.wav -> build/lib.macosx-10.6-intel-3.6/simpleaudio/test_audio
copying simpleaudio/test_audio/g.wav -> build/lib.macosx-10.6-intel-3.6/simpleaudio/test_audio
copying simpleaudio/test_audio/left_right.wav -> build/lib.macosx-10.6-intel-3.6/simpleaudio/test_audio
copying simpleaudio/test_audio/notes_2_16_44.wav -> build/lib.macosx-10.6-intel-3.6/simpleaudio/test_audio
running build_ext
building 'simpleaudio._simpleaudio' extension
creating build/temp.macosx-10.6-intel-3.6
creating build/temp.macosx-10.6-intel-3.6/c_src
/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -DDEBUG=0 -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c c_src/simpleaudio_mac.c -o build/temp.macosx-10.6-intel-3.6/c_src/simpleaudio_mac.o -mmacosx-version-min=10.6
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command '/usr/bin/clang' failed with exit status 1
----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/rm/1wlhdbc15tq591by9qnr4_180000gn/T/pip-build-1201y9fs/simpleaudio/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/rm/1wlhdbc15tq591by9qnr4_180000gn/T/pip-yguvrnt6-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/rm/1wlhdbc15tq591by9qnr4_180000gn/T/pip-build-1201y9fs/simpleaudio/
我的Python版本是
Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
如何为这个Python解释器安装simpleaudio?
答案 0 :(得分:0)
@Zonear的link说...
禁用“系统完整性保护”,以便root可以修改Mac上的所有文件:
Boot into recovery mode (hold [Command]+R during reboot)
In Terminal (from dropdown menu) run `csrutil disable`
Reboot
修复/ usr / local上的权限:
sudo chflags norestricted /usr/local
sudo chown $(whoami):admin /usr/local
sudo chown -R $(whoami):admin /usr/local
重新安装xcode开发人员工具:
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
检查自制食品并按照医生的指示进行操作:
brew update
brew doctor
升级所有现成的软件包:
brew upgrade
如果git --version
提到“ Apple Git”,则需要删除它:
sudo mv /usr/bin/git /usr/bin/git.xcode
sudo ln -s /usr/local/git/bin/git /usr/bin/git
下载并重新安装gpgtools
获得一台Linux笔记本电脑!