Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
314 views
in Technique[技术] by (71.8m points)

How do I switch from python 2.6 to 2.7 by default

How do I switch from python 2.6 to 2.7 by default

ls -l /usr/bin/python*
lrwxrwxrwx 1 root root    9 Jan 27 12:36 /usr/bin/python -> python2.6
lrwxrwxrwx 1 root root    9 Jan 27 12:36 /usr/bin/python2 -> python2.6
-rwxr-xr-x 2 root root 3664 Sep 13 00:25 /usr/bin/python26
-rwxr-xr-x 2 root root 3664 Sep 13 00:25 /usr/bin/python2.6
-rwxr-xr-x 1 root root 1418 Sep 13 00:25 /usr/bin/python2.6-config
-rwxr-xr-x 2 root root 3664 Nov 12 02:03 /usr/bin/python27
-rwxr-xr-x 2 root root 3664 Nov 12 02:03 /usr/bin/python2.7
lrwxrwxrwx 1 root root   22 Sep  1 09:52 /usr/bin/python3 -> /usr/local/bin/python3
lrwxrwxrwx 1 root root   16 Jan 27 12:36 /usr/bin/python-config -> python2.6-config
lrwxrwxrwx 1 root root   16 Jan 27 12:36 /usr/bin/python-config2 -> python2.6-config
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

A lot of Ubuntu packages use python. They also install modules in /usr/lib/pythonX.Y where (X.Y is your default python version).

The python packaging system only provides those modules for the default python.

If you change your default python, it would become your responsibility to provide those modules for the new version of python or else your system will break.

Therefore, unless you really know what you are doing (i.e. you are willing to port and maintain all those modules), I would strongly recommend not trying to change the default version of python.

Instead use virtualenv and virtualenvwrapper to allow you to switch versions at the user level.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...