如何从默认情况下从python 2.6切换到2.7 [英] How do I switch from python 2.6 to 2.7 by default
问题描述
如何在默认情况下从python 2.6切换到2.7
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
推荐答案
很多Ubuntu包蟒蛇。他们还在 /usr/lib/pythonX.Y
中安装模块( X.Y
是您的默认python版本)。
A lot of Ubuntu packages use python. They also install modules in /usr/lib/pythonX.Y
where (X.Y
is your default python version).
python包装系统只为默认的python提供这些模块。
The python packaging system only provides those modules for the default python.
如果您更改了默认python,则会成为您的责任,为新版本的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.
因此,除非你真的知道你在做什么(即你愿意端口和维护所有这些模块),我会强烈建议不要尝试更改默认版本的python。
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.
而是使用 virtualenv
和 virtualenvwrapper
,以允许您在用户级切换版本。
Instead use virtualenv
and virtualenvwrapper
to allow you to switch versions at the user level.
这篇关于如何从默认情况下从python 2.6切换到2.7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!