Mohammed Tiour
Mohammed Tiour

Reputation: 31

Multiple versions of Python in Ubuntu

In Ubuntu, I used to have (two hours ago) three versions of python :

(that means, at a certain point i was able to run the tree versions of python at the same time)

But now, the 3.4.0 version has become a 3.4.3, now i have a 2.7 and two 3.4.3 (one in '/usr/bin' and the other in '/usr/local/bin')

This happened while i was experimenting with PIP. So I'm not able to retrace what I actually did.

My questions are :

  1. Why building the 3.4.3 didn't upgrade the existing 3.4.0, but instead it made a new installation in '/usr/local/bin' ?
  2. What do you think actually happened that upgraded the 3.4.0 to a 3.4.3 ?
  3. Is it 'okay' to have two installations of the same version (3.4.3) of python in my system ?

Upvotes: 1

Views: 14902

Answers (2)

jcoppens
jcoppens

Reputation: 5440

Version 2.x and 3.x happily live together - that is no problem.

But the versions in /usr/bin and /usr/local/bin will give you problems:

  • The 'home'compiled version always installs in /usr/local/bin unless you specify the prefix on compilation. System-installed version normally install in /usr/bin. If you call python3, you will only execute the first one found - probably /usr/local/bin/python3. Test this with which python3

  • The real problem in that you now have two python3.x/site-packages (one in /usr/lib or /usr/lib64, and the other in /usr/local/lib[64]), and installing new modules will update only one of them. (unless you install them twice).

I'd suggest that you uninstall the self-compiled one (3.4.0), using make uninstall in the source directory.

To be clear: I believe there is no problem in having a 2.7 in /usr and 3.x in /usr/local.

Upvotes: 1

Kirell
Kirell

Reputation: 9798

The version 2.7 and 3.4 are your distribution official pythons. To upgrade their versions, Ubuntu should release new packages for them. When you install a new python by yourself it goes to /usr/local/bin.

I don't recommend having two similar pythons on your system, it will probably be difficult to know whether a package is installed into either or the site-packages. You would have to be careful with pip too.

I suggest you remove the pythons installed with apt-get and keep yours in /usr/local/bin.

Upvotes: 0

Related Questions