简体   繁体   English

python 3符号链接到python 2-如何撤消

[英]python 3 symlinked to python 2 - how to undo

Running brew doctor gave me the error recently that python 3 is symlinked to python. 正在运行的brew医生最近给我一个错误,指出python 3与python符号链接。 And when I type python - it does load python 3.4 interpreter. 当我键入python时,它确实会加载python 3.4解释器。 I'm not sure how it happened. 我不确定这是怎么发生的。 I did recently changed the default installed python with virtualenv to python3 (most projects are python 3) with : 我最近确实将带有virtualenv的默认安装的python更改为python3(大多数项目是python 3):

export VIRTUALENV_PYTHON=python3

would this have changed the symlink and what's the best way to change back as 这会改变符号链接吗?

export VIRTUALENV_PYTHON=python

didn't fix it, although I suspect that's because it's already symlinked. 没有修复它,尽管我怀疑那是因为它已经符号链接了。 (I've used brew to install python 2.7 and python 3 and these were previously fine). (我用brew安装python 2.7和python 3,这些以前还不错)。

(if changing the virtualenv setting has caused the issue is there another way to make the default python3 without causing the symlink issue?) (如果更改virtualenv设置导致了此问题,还有另一种方法可以使默认的python3而不引起symlink问题吗?)

You should update brew, then prune any stale links and then re-link Python 2. 您应该更新brew,然后修剪所有过时的链接,然后重新链接Python 2。

  1. brew update
  2. brew upgrade (optional, but highly recommended) brew upgrade (可选,但强烈建议)
  3. brew prune
  4. brew unlink python && brew link python

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM