Raspberry pi update to Python 2.7.9


Wheezy with Python 2.7.9

To run the script SSLserverPi_V1_3.py, you must have an installed Python version 2.7.9 or higher. Unfortunately this is not possible with sudo apt-get install python2.7.9 .

However, you can install Python 2.7.9 using the sources.

Here you'll have a small HowTo

  • Install the necessary library with
sudo apt-get update

sudo apt-get install libssl-dev
  • Download from www.python.org
wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz -P /home/pi
  • Change into the directory and install
cd /home/pi
cd Python-2.7.9/
./configure
make
(make test)
make install
  • Test the version with
python -V

should return “Python 2.7.9” .

If still Python 2.7.3 is returned maybe a reboot could help.

If this is not successful, the cause may be due to the fact that there are now two versions of Python 2 on the Raspberry.

One version is in /usr/bin (this should the  version 2.7.3) and one in /usr/local/bin. Just to be sure, you can use the "/usr/ local/bin/python -V" command to check if the version 2.7.9 is installed at all. Return should be "Python 2.7.9".

If so, you can set a new link  under /usr/ bin.

The procedure is as follows:

  • Change into the directory
cd /usr/bin
  • List the relevant entries in the directory
 ls -l | grep python

it will show something like this

-rwxr-xr-x  1 root root      31211 Sep 28  2013 dh_python2
-rwxr-xr-x  1 root root      21988 Oct 21  2012 dh_python3
-rwxr-xr-x  1 root root         94 Mar 13  2014 idle-python2.7
-rwxr-xr-x  1 root root         94 Feb 20  2013 idle-python3.2
lrwxrwxrwx  1 root root         23 Mar 18  2014 pdb2.7 -> ../lib/python2.7/pdb.py
lrwxrwxrwx  1 root root         23 Mar  1  2013 pdb3.2 -> ../lib/python3.2/pdb.py
lrwxrwxrwx  1 root root         31 Oct 21  2012 py3versions -> ../share/python3/py3versions.py
lrwxrwxrwx  1 root root          9 Sep 28  2013 python -> python2.7
lrwxrwxrwx  1 root root          9 Sep 28  2013 python2 -> python2.7
-rwxr-xr-x  1 root root    2674536 Mar 18  2014 python2.7
lrwxrwxrwx  1 root root          9 Oct 21  2012 python3 -> python3.2
lrwxrwxrwx  1 root root         11 Mar  1  2013 python3.2 -> python3.2mu
-rwxr-xr-x  1 root root    2814320 Mar  1  2013 python3.2mu
lrwxrwxrwx  1 root root         11 Oct 21  2012 python3mu -> python3.2mu
lrwxrwxrwx  1 root root         29 Sep 28  2013 pyversions -> ../share/python/pyversions.py

Now you can reset the red marked link.

sudo ln -sf /usr/local/bin/python python