【发布时间】:2019-03-31 02:36:13
【问题描述】:
我正在尝试安装 python 3,因为我想使用 python 3 进行项目。我发现的说明不起作用,所以我大胆地运行 brew install python。错误的举动。现在,当我运行 python -V 时,我得到“Python 3.7.3”,当我尝试输入 virtualenv 时,我得到 -bash: /Users/elliot/Library/Python/2.7/bin/virtualenv: /usr/local/opt/python/bin/python2.7: bad interpreter: No such file or directory
我的~/.bash_profile 读作
export PATH="/Users/elliot/Library/Python/2.7/bin:/usr/local/opt/python/libexec/bin:/Library/PostgreSQL/10/bin:$PATH"
但是ls /usr/local/Cellar/python/ 得到了我3.7.3 所以看来brew 甚至不知道我的旧2.7 版本了。
我想我想要的是将我的系统 python 重置为 2.7,然后将 python 3 添加为在我的系统上运行的单独 python。我一直在谷歌搜索,但没有找到任何关于如何专门使用 brew 来执行此操作的建议。
编辑:如果我知道如何让 virtualenv 再次工作,我也会很高兴保留 Python 3.7。我记得听说升级你的系统 python 会破坏一切,但我很高兴知道这是否是过时的知识,我只是一个坚持 2.7 的 luddite。
【问题讨论】:
-
看起来 hombrew 想帮您一个忙... ;)
-
是的,我知道,我还在 2.7 上做什么?答案是试图不处理此时的升级。如果更新我的路径更简单,以便 virtualenv 知道如何再次运行,我也会对这个解决方案感到满意。
标签: python python-3.x python-2.7 homebrew