简体   繁体   中英

python 3 symlinked to python 2 - how to undo

Running brew doctor gave me the error recently that python 3 is symlinked to python. And when I type python - it does load python 3.4 interpreter. 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 :

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).

(if changing the virtualenv setting has caused the issue is there another way to make the default python3 without causing the symlink issue?)

You should update brew, then prune any stale links and then re-link Python 2.

  1. brew update
  2. brew upgrade (optional, but highly recommended)
  3. brew prune
  4. brew unlink python && brew link python

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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