python新手,在安装python环境,跑系统的时候总是安装不成功,报错(见下面),总是找不到原因,最后只能仔细看报错日志,终于找到了一个熟悉的字符:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
果断google,找到原因,切出虚拟环境,在mac 终端中输入
xcode-select --install
回车执行,等待安装成功。然后重新在虚拟环境安装各个依赖包,成功。
Building wheel for ujson (setup.py) ... error
ERROR: Complete output from command /usr/local/work/python/venvs/venv/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/r6/4jgxylx12zscvcps6j_330gr0000gn/T/pip-install-R3YQzb/ujson/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/r6/4jgxylx12zscvcps6j_330gr0000gn/T/pip-wheel-th00LL --python-tag cp27:
ERROR: running bdist_wheel
running build
running build_ext
building 'ujson' extension
creating build
creating build/temp.macosx-10.14-intel-2.7
creating build/temp.macosx-10.14-intel-2.7/python
creating build/temp.macosx-10.14-intel-2.7/lib
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I./python -I./lib -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c ./python/ujson.c -o build/temp.macosx-10.14-intel-2.7/./python/ujson.o -D_GNU_SOURCE
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command 'cc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for ujson
Running setup.py clean for ujson
Failed to build ujson
Installing collected packages: ujson
Running setup.py install for ujson ... error