在指示MacPorts切换到Python 3.4之后,python --version
仍输出2.7.10。请注意,“这蟒蛇”它只表示的/ opt/local/bin目录之前来的/ usr/bin中/在我的道路:MacPorts表示,当运行“python --version”时,我仍然拥有Python 2.7
$ which python
/opt/local/bin/python
$ python --version
Python 2.7.10
$ ls -l /opt/local/bin/python
lrwxr-xr-x 1 root wheel 24 Aug 1 10:00 /opt/local/bin/python -> /opt/local/bin/python2.7
$ sudo port select --list python
Available versions for python:
none
python26-apple
python27 (active)
python27-apple
python34
$ sudo port select --set python python34
Selecting 'python34' for 'python' succeeded. 'python34' is now active.
$ which python
/opt/local/bin/python
$ python --version
Python 2.7.10
$ ls -l /opt/local/bin/python
lrwxr-xr-x 1 root wheel 24 Aug 1 10:00 /opt/local/bin/python -> /opt/local/bin/python3.4
注意符号链接怎么做改变,但所陈述的版本不会改变。是什么赋予了?
尝试在符号链接更改后重新引导shell。 – Zcode
是的!这工作。你能简单解释为什么shell每次都不重新读取符号链接吗? – Labrador
我很抱歉,但我在GNU/Linux系统中是一个初学者,我知道当你创建一个别名时(例如在'bash_aliases'文件中),你必须刷新bash shell。 – Zcode