Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
13
rated 0 times [  13] [ 0]  / answers: 1 / hits: 40271  / 1 Year ago, sun, december 18, 2022, 10:34:17

I have Python 2.7.3 and 3.2.3 installed on my Ubuntu 12.04 64bit (by default?). When I type "python", I want python 3.2 instead of 2.7.



Changing symlink "python" to link to python3 seems to cause big problems. Why is that and is there a way to do that?



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


I linked python to python3:



sudo ln -fs python3 python


It worked but later it forced me to change the link back because Ubuntu seems not much responsive and I can't run most of the applications any more, such as Variety, Spyder, Okular, Software Center, etc.



Edit:

Yes, the 2 answers in the marked duplicate question Problems upgrading to Python 3.3 and setting up Django addressed half of my question, and the question itself doesn't seem to be related to my question when I try to search for an answer. I doubt anyone would realize the answer is below that question.


More From » 12.04

 Answers
0

If you want to use python3 instead of python2.7 just when you manually run python applications, just add:



alias python='python3'


to your ~/.bash_aliases file. (The file may be empty depending on whether you have added any aliases in the past.)



The applications other than the ones you manually start will continue using python2.7 or python3 as before.


[#29232] Tuesday, December 20, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brasiplacar

Total Points: 314
Total Questions: 124
Total Answers: 97

Location: Dominican Republic
Member since Wed, Mar 17, 2021
3 Years ago
brasiplacar questions
Sat, Sep 4, 21, 13:11, 3 Years ago
Tue, Jan 10, 23, 06:22, 1 Year ago
Wed, Oct 13, 21, 15:19, 3 Years ago
Wed, May 4, 22, 00:06, 2 Years ago
Thu, Jan 5, 23, 15:40, 1 Year ago
;