1

Can anyone give some advice how to upgrade 2.7.X version of python to the 2.7.14 version? I've tried to upgrade my current version(2.7.9) from the source code with the following steps:

  1. wget -c https://www.python.org/ftp/python/2.7.14/Python-2.7.14.tgz
  2. tar -xvf Python-2.7.14.tgz
  3. cd Python-2.7.14
  4. sudo ./configure
  5. sudo make
  6. sudo make install

Configuring and compiling the source code took some time, and ultimately finished without errors (at least i didn't notice any). I've rebooted my device and after rebooting I tried to install different python modules using PIP. When all modules were successfully installed I tried to import them and for each got the same message: "ImportError: No module named 'module_name'". After that I've uninstalled all modules and tried to install them with following command: "sudo apt-get install python-'module_name'", but the result after importing was the same like in previous step. I don't know what to do next so any suggestion or advice would be helpful and time-saving.

0

(You haven't mentioned, but I assume you are using an Ubuntu Linux as you have the "apt-get" command.)

You installed the python from source and tried to install the modules via apt, this is not something what definitely works (because they most likely uses different pathes).

First off all, if you are not confident with package management and in general how to install/upgrade softwares on Ubuntu I would suggest to always use apt and don't install from source. Installing from source anyway makes the maintenance hard (as you don't use a package management, so after a while you will be lost what and where is installed). Indeed using only apt doesn't always gives you the latest versions (do you really need that?), but makes maintenance/upgrades much easier.

In your case you can even find an unofficial(!) PPA repo to be able to install the latest python via apt: https://launchpad.net/~jonathonf/+archive/ubuntu/python-2.7

I would suggest to clean up first what you installed with the make install...

If you still insist to install from source, there is a description for that on askubuntu: How do I install the latest Python 2.7.X or 3.X on Ubuntu?

1
  • Actually, I'm working on BeagleBone devices. One with Ubuntu 16.04.3 and other with Debian 8.9 (Jessie), on both devices I had the same issues after upgrading form the source. I also tried adding the PPA repo you were mentioned and upgrade from it, but without any luck. I'll try to follow descriptions you shared on that "askubuntu" link and see if that solution works. – Boixos Noi Jan 30 '18 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.