问题
I have two python installations..
python
--> /Users/fraz/anaconda/bin/python
(python2.7)
python3.7
--> /usr/local/bin/python3.7
Now.. I want reassign the commands. Such that
python
points to python3.7
--> /usr/local/bin/python3.7
and python2
points to python2.7
/Users/fraz/anaconda/bin/python
How do i do this reassignment?
回答1:
follow this question, modify your ~/.bashrc
, add a new line:
alias python=python3.7
save and exit then open terminal, type
source ~/.bashrc
in my machine, typing python2
will open python 2.x by default. but if needed, you can add a new alias
alias python2=python2.7
回答2:
you can use softlink
ln -s /usr/bin/python /usr/local/bin/python3.7
来源:https://stackoverflow.com/questions/57368515/make-python-run-python3-at-the-prompt