我在Ubuntu 12.04 64位上安装了Python 2.7.3和3.2.3(默认情况下?)。当我输入“ python”时,我希望使用python 3.2而不是2.7。
将symlink“ python”更改为链接到python3似乎会引起很大的问题。为什么会这样,有办法做到吗?
lrwxrwxrwx 1 root root 7 Sep 28 19:15 python -> python2
lrwxrwxrwx 1 root root 9 Jun 18 13:26 python2 -> python2.7
-rwxr-xr-x 1 root root 2993592 Apr 10 02:46 python2.7
-rwxr-xr-x 1 root root 1652 Apr 10 02:46 python2.7-config
lrwxrwxrwx 1 root root 16 Jun 18 13:26 python2-config -> python2.7-config
lrwxrwxrwx 1 root root 9 Apr 10 17:12 python3 -> python3.2
lrwxrwxrwx 1 root root 11 Apr 10 02:13 python3.2 -> python3.2mu
-rwxr-xr-x 1 root root 2949952 Apr 10 02:13 python3.2mu
lrwxrwxrwx 1 root root 11 Apr 10 17:12 python3mu -> python3.2mu
lrwxrwxrwx 1 root root 16 Jun 18 13:26 python-config -> python2.7-config
我将python链接到python3:
sudo ln -fs python3 python
它起作用了,但是后来迫使我改回链接,因为Ubuntu似乎反应不灵敏,而且我无法再运行大多数应用程序,例如Variety,Spyder,Okular,Software Center等。
编辑:
是的,标记为重复的问题中的2个答案问题升级到Python 3.3和设置Django时解决了我一半的问题,当我尝试搜索答案时,问题本身似乎与我的问题无关。我怀疑有人会意识到答案就在那个问题下面。
如果你想使用python3,而不是仅仅在python2.7你手动运行Python应用程序,只需添加:
alias python='python3'
到您的~/.bash_aliases
文件。(文件可能是空的,具体取决于您过去是否添加了任何别名。)
除了您手动启动的应用程序之外,其他应用程序将像以前一样继续使用python2.7或python3。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句