Python2和3切换默认

2017-02-20
#Python #Unix
  ~ which python
/usr/local/bin/python
  ~ python -V
Python 3.5.0
  ~ python2 -V
Python 2.7.6
  ~ python3 -V
zsh: command not found: python3
  ~ which python
/usr/local/bin/python
  ~ l /usr/local/bin/python
lrwxrwxrwx. 1 root root 35 Nov  4  2015 /usr/local/bin/python -> /usr/local/Python-3.5.0/bin/python3
  ~ cd /usr/local/bin/
  which python2
/usr/bin/python2
  ls -alch py*
lrwxrwxrwx. 1 root root 35 Nov  4  2015 python -> /usr/local/Python-3.5.0/bin/python3
  ln -s /usr/bin/python2 python
ln: creating symbolic link `python': File exists
  rm -rf python
  ln -s /usr/bin/python2 python
  cd
  ~ python