Changing default python to another version

后端 未结 7 726
死守一世寂寞
死守一世寂寞 2021-01-01 05:35

Currently when I use \"python\" command, it points to python2.6. I have installed python3.1 and I want the \"python\" command point to python3.1. How it is possible?

7条回答
  •  执笔经年
    2021-01-01 06:22

    Since you have Linux, and if you want to simply type "python" instead of "python3" in order to run Python programs, a solution is simply to define an alias in you shell configuration file (.bashrc, etc.). For Bourne shells, it should be something like

    alias python=python3
    

    (or whatever your Python 3 name is).

    This way, you do not have to change anything on your system, so this solution should quite innocuous and it should not break your system.

提交回复
热议问题