5

I have downloaded and installed python 3.2.3 for Ubuntu/Debian. Also IDLE IDE for 3.2.3.

If I execute IDLE for 3.2.3 explicitely, 3.2.3 runs under IDLE and all is well.

But if I go to a terminal session and simple run Python, it defaults to python 2.7.3. Also my Python commercial IDE (Wingware) defaults to Python 2.7.3.

How can I change my global Python default to be 3.2.3 instead of 2.7.3?

Vector
  • 781
  • In a terminal, you can just run python3. There's probably a setting somewhere for Wing. – Thomas K Nov 11 '12 at 15:59
  • Yes python3 works fine from terminal. But I cannot seem to find the right path to the binary so that I can tell Wing to use it. I installed it with synaptic -any idea where it is? I am new to Linux. – Vector Nov 12 '12 at 08:16
  • It should be /usr/bin/python3. – Thomas K Nov 12 '12 at 13:07
  • Thanks - will check out. As I was reading this morning about Linux file system I figured that's where it would be. – Vector Nov 12 '12 at 16:53

3 Answers3

8

Don't do it

Since many important programs are written in python changing default python may crash your system, so set python for individual apps. You can locate python3 at /usr/bin/python3 . If you want python3 by default try Ubuntu 12.10

Tachyons
  • 17,281
  • Understood. python3 works fine from terminal. But I cannot seem to find the right path to the binary so that I can tell Wing to use it. I installed it with synaptic -any idea where it is? I am new to Linux. – Vector Nov 12 '12 at 08:17
  • Sure?. I'm using 12.10 and python 2.7 seems to be the default. – Javier Rivera Nov 12 '12 at 08:33
  • @Mikey: at /usr/bin/python3 – Tachyons Nov 12 '12 at 09:38
  • @Javier Rivera: Strange!, Default python in 12.10 is python 3.2, Please recheck it :) – Tachyons Nov 12 '12 at 09:40
  • Rechecked. It's 2.7. I have also find this question: http://askubuntu.com/questions/202483/12-10-has-python-3-2-3-default-does-this-impact-existing-python-tools.

    Looks like python3 is installed by default in 12.10, but python3 is not the default python for 12.10.

    – Javier Rivera Nov 12 '12 at 10:30
  • 1
    @Tachyons: There's no plan to make Python 3 run when you type python in a terminal. Even when Python 2 is dropped from the default installation (which hasn't happened yet), Python 3 will be python3. Debian & Ubuntu are playing it that way to avoid breaking things. – Thomas K Nov 12 '12 at 13:09
  • @Tachyons - /usr/bin/python3 works fine in Wing. Thanks. – Vector Nov 13 '12 at 17:58
2

I would not recommend overwriting the system python binaries.

I mainly use Perl and Perlbrew for testing code and new Perl releases.

You may want to check out something like Pythonbrew that will allow you to maintain your system Python while providing you a sandbox to play in with your newer distribution.

Flimm
  • 41,766
Kevin Bowen
  • 19,615
  • 55
  • 79
  • 83
0

I had a problem where someone changed my default python fom 2.x to 3.x and that broke everything. So, if anyone has the same problem as me (and yea blah blah do it at your own risk) you need to do the following:

  1. Make sure that /usr/bin/python is a link: ls -l /usr/bin/python should give you at the end /usr/bin/python -> /usr/bin/python3

  2. sudo rm /usr/bin/python removes the link

  3. Finally, create a new link by doing sudo ln -s /usr/bin/python2 /usr/bin/python

WARNING

Don't do this if everything is working fine! I kept getting syntax errors because python3 has to have print() functions have brackets, and my filesystem was made with python2. This fixed it.

Sergey
  • 133