0

I have a hosted server running Ubuntu 15.10, as I use Python 3.6 on my development machine I installed that (wget URL, configure, make, make install etc), this is the point I realised that Ubuntu already had Python 3.4.3 already installed and my life was becoming complicated.

The first symptom of having multiple versions was getting pip to behave, I had a lot of trouble and ended up removing the Ubuntu version of Python and reinstalling it. This seemed to fix things (mostly), but python3 now is linked to my python 3.6.0 install, but pip3 is linked to the 3.4.3 version.

If I start python with python3.4 then it loads the 3.4.3 and I can use it with the packages I have downloaded (primarily MySQLdb (the fork for 3x Python)).

All the above is obviously not ideal, but I thought since it works I will keep testing my setup. The problem is that when the www-data user runs python3.4 it cannot find the packages; I presume it is looking in the wrong place.

Ideally I would like to get rid of Python3.6.0 and just use the native bundled 3.4.3. The multiple installs seem to be causing pip (and me) a lot of confusion.

muru
  • 197,895
  • 55
  • 485
  • 740
Blair
  • 103

1 Answers1

1

All self compiled packages almost always goes in /usr/local/ unless you change the install PATH or if the developers have other non standard things like /opt/ as default.

I assume there's a /usr/local/bin/python3 which you can rename to e.g. /usr/local/bin/python3.6.0 and that might fix it all already.

Can you do a :

find /usr/ -iname "python3"

I suggest to try :

sudo mv /usr/local/bin/python3 /usr/local/bin/python3.6.0 

It is possible that "bash" still "thinks" that python3 is in /usr/local/bin/ while you have it in /usr/bin/python3 You can log out and log in again, and try again.

albert j
  • 1,453
  • Running the above outputs:

    /usr/lib/python3 /usr/bin/python3 /usr/share/lintian/overrides/python3 /usr/share/python3 /usr/share/doc/python3 /usr/local/bin/python3 $

    – Blair Jan 30 '17 at 20:28
  • Looking in just the /usr/local/bin I see the following:

    $ cd /usr/local/bin $ ls 2to3 2to3-3.6 idle3 idle3.6 pip pip3 pip3.4 pydoc3 pydoc3.6 python3 python3-config python3.6 python3.6-config python3.6m python3.6m-config pyvenv pyvenv-3.6

    – Blair Jan 30 '17 at 20:29
  • That did it - I had to uninstall and reinstall my packages with pip to sort them out, but now all is well; thanks! – Blair Jan 31 '17 at 01:03