目录
问题描述
在mac安装Jupyter Notebook,更新过pip后,执行命令
pip install jupyter
出现Failed to build argon2-cffi的提示,终止了安装。
报错内容
Building wheels for collected packages: pandocfilters, argon2-cffi
Building wheel for pandocfilters (setup.py) ... done
Created wheel for pandocfilters: filename=pandocfilters-1.4.2-py3-none-any.whl size=7855 sha256=a497e186f164aaea0eb9f1bd38d88b2dabef72ca42197ef8d5d5c0c00480e021
Stored in directory: /Users/xxx/Library/Caches/pip/wheels/24/fa/41/de6b78141bb2c6d8737e438204dceab593c386d6345f37e0d7
Building wheel for argon2-cffi (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3 /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /var/folders/vg/4yvm6t0d4ygf63gd2wlhllnw0000gn/T/tmpxe0_bs43
cwd: /private/var/folders/vg/4yvm6t0d4ygf63gd2wlhllnw0000gn/T/pip-install-ytoqrue8/argon2-cffi
Complete output (24 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.6
creating build/lib.macosx-10.9-x86_64-3.6/argon2
copying src/argon2/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/argon2
copying src/argon2/low_level.py -> build/lib.macosx-10.9-x86_64-3.6/argon2
copying src/argon2/_ffi_build.py -> build/lib.macosx-10.9-x86_64-3.6/argon2
copying src/argon2/_password_hasher.py -> build/lib.macosx-10.9-x86_64-3.6/argon2
copying src/argon2/exceptions.py -> build/lib.macosx-10.9-x86_64-3.6/argon2
copying src/argon2/_legacy.py -> build/lib.macosx-10.9-x86_64-3.6/argon2
copying src/argon2/__main__.py -> build/lib.macosx-10.9-x86_64-3.6/argon2
copying src/argon2/_utils.py -> build/lib.macosx-10.9-x86_64-3.6/argon2
running build_clib
building 'argon2' library
creating build/temp.macosx-10.9-x86_64-3.6
creating build/temp.macosx-10.9-x86_64-3.6/extras
creating build/temp.macosx-10.9-x86_64-3.6/extras/libargon2
creating build/temp.macosx-10.9-x86_64-3.6/extras/libargon2/src
creating build/temp.macosx-10.9-x86_64-3.6/extras/libargon2/src/blake2
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -msse2 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/argon2.c -o build/temp.macosx-10.9-x86_64-3.6/extras/libargon2/src/argon2.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for argon2-cffi
Successfully built pandocfilters
Failed to build argon2-cffi
ERROR: Could not build wheels for argon2-cffi which use PEP 517 and cannot be installed directly
解决思路
首先尝试解决了argon2-cffi,但是没有效果。
于是试着解决导致argon2-cffi安装失败的原因,发现分割线上面数第二行的error,xcrun出现了问题,没有找到这个文件。
解决方法
通过终端安装xcrun,执行命令
xcode-select --install
将弹出安装框,发现是一种字体(?)。安装完成后,再次执行Jupyter的安装命令,即可成功安装。
Successfully built argon2-cffi
Installing collected packages: jupyter-core, pyzmq, jupyter-client, ipykernel, jupyter-console, argon2-cffi, Send2Trash, terminado, pandocfilters, entrypoints, mistune, webencodings, bleach, testpath, defusedxml, nbconvert, prometheus-client, notebook, widgetsnbextension, ipywidgets, qtpy, qtconsole, jupyter
Attempting uninstall: jupyter-core
Found existing installation: jupyter-core 4.4.0
Uninstalling jupyter-core-4.4.0:
Successfully uninstalled jupyter-core-4.4.0
Successfully installed Send2Trash-1.5.0 argon2-cffi-20.1.0 bleach-3.1.5 defusedxml-0.6.0 entrypoints-0.3 ipykernel-5.3.4 ipywidgets-7.5.1 jupyter-1.0.0 jupyter-client-6.1.6 jupyter-console-6.1.0 jupyter-core-4.6.3 mistune-0.8.4 nbconvert-5.6.1 notebook-6.1.3 pandocfilters-1.4.2 prometheus-client-0.8.0 pyzmq-19.0.2 qtconsole-4.7.5 qtpy-1.9.0 terminado-0.8.3 testpath-0.4.4 webencodings-0.5.1 widgetsnbextension-3.5.1