在指示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