当我尝试运行命令pip install simpleaudio时,这是它在终端中返回的内容:
<code>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/
</code>
如果我尝试使用python3 -m pip install simpleaudio安装它,我会得到以下输出:
<code>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('rn', '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('rn', '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/
</code>
我的Python版本是
<code>Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] </code>
如何为这个Python解释器安装simpleaudio?
解决方法:
@ Zonear的link说……
禁用“系统完整性保护”,以便root可以修改Mac上的所有文件:
<code>Boot into recovery mode (hold [Command]+R during reboot) In Terminal (from dropdown menu) run `csrutil disable` Reboot </code>
修复/usr/local上的权限:
<code>sudo chflags norestricted /usr/local sudo chown $(whoami):admin /usr/local sudo chown -R $(whoami):admin /usr/local </code>
重新安装xcode开发人员工具:
<code>sudo rm -rf /Library/Developer/CommandLineTools xcode-select --install </code>
检查自制软件并按照医生的要求进行操作:
<code>brew update brew doctor </code>
升级所有brew安装的软件包:
<code>brew upgrade </code>
如果git –version提到“Apple Git”你需要摆脱它:
<code>sudo mv /usr/bin/git /usr/bin/git.xcode sudo ln -s /usr/local/git/bin/git /usr/bin/git </code>
下载并重新安装gpgtools
获取Linux笔记本电脑!
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!