Bash alias --> Python 2.7 to Python 3.3

江枫思渺然 提交于 2019-12-06 05:01:25

问题


I am trying to make Python 3.4.2 the default in Linux (currently it is 2.7.6). I am not very knowledgeable on this stuff, but I have read in several places online that you can simply put an alias in the ~/.bashrc or ~/.bash_aliases file like this:

alias python='python3'

I don't have either the ~/.bashrc or ~/.bash_aliases file . . . I am assuming you can just create them. I have done that, but the alias doesn't seem to be working. Am I missing something? Do you need the shebang at the beginning of the file? I have tried it both ways.

Thanks for any help you can give!


回答1:


DON'T DO IT!

Some linux utilities depend on python2.x currently. It will probably break your system if you make that change since python3.x is not backward compatible with python2.x. Unless you are fully aware of the consequences, don't do it!

Similar question is asked here : https://askubuntu.com/questions/103469/how-do-i-change-my-pythonpath-to-make-3-2-my-default-python-instead-of-2-7-2



来源:https://stackoverflow.com/questions/27789972/bash-alias-python-2-7-to-python-3-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!