Install Python 3.3.5 or 3.4 via PPA in Ubuntu 14.04 / 12.04

Last updated: October 7, 2014

This quick tutorial is going to show you how to install Python 3.3.5 (or 3.4.0) and set as default in Ubuntu 14.04 and Ubuntu 12.04.

Python 3.3.5 was released on March 9th, 2014. It fixed:

  • a 3.3.4 regression in zipimport
  • a 3.3.4 regression executing scripts with a coding declared and Windows newlines
  • potential DOS using compression codecs in bytes.decode()

Python 3.4.0 was released one week later than 3.3.5 with below new features:

  • a “pathlib” module providing object-oriented filesystem paths
  • a standardized “enum” module
  • a build enhancement that will help generate introspection information for builtins
  • improved semantics for object finalization
  • adding single-dispatch generic functions to the standard library
  • a new C API for implementing custom memory allocators
  • changing file descriptors to not be inherited by default in subprocesses
  • a new “statistics” module
  • standardizing module metadata for Python’s module import system
  • a bundled installer for the pip package manager
  • a new “tracemalloc” module for tracing Python memory allocations
  • a new hash algorithm for Python strings and binary data
  • a new and improved protocol for pickled objects
  • a new “asyncio” module, a new framework for asynchronous I/O

Install:

A third party launchpad PPA contains older and newer Python version for Ubuntu. The two Python releases are available in the PPA for Ubuntu 14.04 and Ubuntu 12.04.

To add the PPA, press Ctrl+Alt+T on keyboard to open the terminal and run:

sudo add-apt-repository ppa:fkrull/deadsnakes

You may read the PPA description in the output and then:

Install Python 3.3.5 via:

sudo apt-get update; sudo apt-get install python3.3

Or install python 3.4.0 via:

sudo apt-get update; sudo apt-get install python3.4

To set your installed python as default, run the below commands one by one (You may change python3.3 to python3.4 in the code):

rm /usr/local/bin/python  

ln -s /usr/local/bin/python3.3 /usr/local/bin/python

Twitter

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via ubuntuhandbook1@gmail.com Buy me a coffee: https://ko-fi.com/ubuntuhandbook1 |

6 responses to Install Python 3.3.5 or 3.4 via PPA in Ubuntu 14.04 / 12.04

  1. Hello!

    Thanks for this quick tutorial. I have used it to install Python 3.4 in my Elementary Os (a Ubuntu based Linux distribution).

    I would like to make one indication. In Python 3.4 Ubuntu package from ppa:fkrull/deadsnakes when you create a a virtual environment (with pyvenv-3.4) pip is installed under local/bin instead of bin.
    So to use it you have to modify the activate script at line 44. It should be

    PATH=”$VIRTUAL_ENV/bin:$VIRTUAL_ENV/local/bin:$PATH”

  2. The same issue here on ubuntu 12.04 with python3.4 that @Ciges commented.

    I dumped the ./local/ folder completely

    Then downloaded https://bootstrap.pypa.io/get-pip.py and made it executable, then installed it into the virtual environment:

    python get-pip.py

    Pip and easy_install are now in ./bin/ and all subsequent calls to pip just work fine so far. No need to adjust the activate script.

    • Another way is to use the new ensurepip module.


      source bin/activate
      rm -r ./local/
      python -m ensurepip

      This will also install pip into bin.

  3. Mr. Reyes Pandares November 29, 2015 at 5:13 pm

    Hi, I am a new user of ubuntu 12.04 and your instructions are very clear and precise, english is not my mother tongue I do speak spanish, I do apologize for my poor english, I wonder, is it possible to switch python 3.4 to spanish?.
    Thanks for your help. I lived in Venezuela in san carlos cojedes.

  4. Thank You ,so much for this quick tutorial ,i have been searching for upgrading the python version,its really helpful for me ,thanks a lot

  5. Hi,
    thanks for the quick tutorial. I am a newbie in ubuntu.I faced one difficulty in setting python 3.5 as default. when I typed the following
    rm /usr/local/bin/python
    It said..
    rm: cannot remove `/usr/local/bin/python’: No such file or directory
    Little help here please.