Changing default python to another version

后端 未结 7 757
死守一世寂寞
死守一世寂寞 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:05

    You could follow this procedure:

    sudo rm /usr/bin/python

    sudo ln -s /usr/bin/python3.1 /usr/bin/python

    But as already stated by Petr Viktorin, any programs that would expect python v2 would stop to work. So use with caution. You can undo the change by running:

    sudo rm /usr/bin/python

    sudo ln -s /usr/bin/python2.6 /usr/bin/python

提交回复
热议问题