Ubuntu

Installing Python 2.7.11 and 3.5 side-by-side without impacting your system python

Contributed by: Views:2,516

Get the latest 2.7 and 3.5 python along side your system version.

We are running a few scripts for a project that run into Python < 2.7.9's libssl warnings. These can get pretty annoying and rather than just disable these warnings, it's best to upgrade to a more recent version of python.

The problem is, of course, that Mac OS X depends on Python in various places. You might also be running Ubuntu programs that require the version your release ships with.

These instructions are for Mac OS X and Ubuntu but Anaconda does also support Windows.

Anaconda makes it easy to get both the latest 2.7 build and 3.5 installed at the same time as your system python.

Installation

  1. Download Anaconda 2.7.11 installer from https://www.continuum.io/downloads
  2. Run the installer. You should now have Python 2.7.11 as your default python binary when starting a normal terminal / shell.
  3. Install Python 3.5 (optional):
    $ conda create -n python3 python=3.5 anaconda
    

Running Python

With this installation you can now run three versions of Python.

To run 2.7.11 (the default):

$ python --version
Python 2.7.11 :: Anaconda 4.0.0 (x86_64)

To run 3.5:

$ source activate python3
$ python --version
Python 3.5.1 :: Anaconda 4.0.0 (x86_64)

To run system python:

1. Don't start with .bashrc (this will be the case for most server software, etc.)

or

2. Run with full path:

$ /usr/bin/python --version
Python 2.7.10