制作“蟒蛇"在提示符下运行 python3 [英] Make "python" run python3 at the prompt

查看:46
本文介绍了制作“蟒蛇"在提示符下运行 python3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆