我有python (也就是python2)和python3,它们都安装在我的MacOSHigh塞拉利昂上。我在做一些安装,在其中我运行:
brew install automake
brew install doxygen
brew install ant在这些过程中,我的brew也必须被更新。现在,我意识到,在过去几个月里一直运转良好的python3已经消失了。
> brew update
Already up-to-date.
> brew install python
Error: python 2.7.14 is already installed
To upgrade to 3.6.4_4, run `brew upgrade python`
> brew install python3
Error: python 2.7.14 is already installed
To upgrade to 3.6.4_4, run `brew upgrade python`现在,我似乎无法重新安装python3。更重要的是,我担心如果我运行brew upgrade python,我将失去对python2的访问。
PS:我在打开终端时注意到没有python3,它说:
Last login: Sat Mar 10 15:16:43 on ttys002
virtualenvwrapper_run_hook:12: no such file or directory: /usr/local/bin/python3
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3 and that PATH is
set properly.对于如何解决这个问题,或者问题的原因是什么,有什么想法吗?
发布于 2018-04-03 12:39:24
如果其他人有同样的问题,brew upgrade python不会破坏任何东西。我运行了它,我仍然可以访问Python 2,另外,我还获得了Python 3。
发布于 2018-03-13 05:27:24
原因在这里解释:https://brew.sh/2018/01/19/homebrew-1.5.0/
我建议添加新的公式:brew install python@2
运行brew info python@2,您将获得安装包的位置:
/usr/local/Cellar/python@2/2.7.14_3
请记住python@2是一个“只用于桶”的公式,这意味着它没有链接到/usr/local。在这一点上,根据您的需要,您应该强制链接到它,如果需要。首先,尝试一个--dry-run来了解将要发生的事情:
brew link --force --dry-run python@2如果不想运行brew link命令,则始终创建一个方便的符号链接(如果运行公式更新,则必须保持链接更新):
ln -s ../Cellar/python@2/2.7.14_3/bin/python python2底线是,自制软件开始考虑python2过时了。
https://stackoverflow.com/questions/49208439
复制相似问题