制作“蟒蛇"在提示符下运行 python3 [英] Make "python" run python3 at the prompt
问题描述
我有两个 python 安装..
I have two python installations..
python
--> /Users/fraz/anaconda/bin/python
(python2.7)
python
--> /Users/fraz/anaconda/bin/python
(python2.7)
python3.7
--> /usr/local/bin/python3.7
现在..我想重新分配命令.这样的python
指向 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
和python2
指向python2.7
/Users/fraz/anaconda/bin/python
我该如何进行重新分配?
How do i do this reassignment?
推荐答案
follow 这个问题,修改你的~/.bashrc
,增加一行:
follow this question, modify your ~/.bashrc
, add a new line:
alias python=python3.7
保存并退出然后打开终端,输入
save and exit then open terminal, type
source ~/.bashrc
在我的机器上,输入 python2
将默认打开 python 2.x.但如果需要,您可以添加新别名
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
这篇关于制作“蟒蛇"在提示符下运行 python3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!