oro*_*ome 7 python homebrew ipython jupyter
自从使用Homebrew更新我的Python
jupyter --version
Run Code Online (Sandbox Code Playgroud)
给
-bash: /usr/local/bin/jupyter: /usr/local/opt/python/bin/python2.7: bad interpreter: No such file or directory
Run Code Online (Sandbox Code Playgroud)
这是有道理的,因为不再有Python了/usr/local/.../python2.7.但我没有看到任何修复方法.
在更新Python之前,我有一个Python,而Homebrew的符号链接python指向那里,但现在which -a python给出了
/usr/local/opt/python@2/libexec/bin/python
/usr/local/bin/python
/usr/bin/python
Run Code Online (Sandbox Code Playgroud)
这对应于我想要的,分别是
PATH我也brew link --overwrite --force python2 很好,但这没有效果.
如何jupyter找到并使用我的Python 2.7 PATH?
小智 9
对我有用,它只是将 Jupiter 与正确的 Python 版本联系起来。
rm '/usr/local/bin/jupyter'
brew link --overwrite jupyter
brew link --overwrite --dry-run jupyter
brew unlink jupyter && brew link jupyter
Run Code Online (Sandbox Code Playgroud)
使用python@2公式,Homebrew将Python 2移动为keg-only .该jupyter公式已相应更新,请升级:
brew update && brew upgrade jupyter
Run Code Online (Sandbox Code Playgroud)
需要注意的是Python的2进制现在仅作为python2的python二进制文件,如果安装了自制,是Python 3中.
如果您使用pip安装它,请链接Python 2二进制文件并使用pip2以下命令重新安装jupyter :
brew link -f python@2
/usr/local/bin/pip2 install -U jupyter
Run Code Online (Sandbox Code Playgroud)
你最终得到一个/usr/local/bin/jupyter以该行开头的文件#!/usr/local/opt/python@2/bin/python2.7.