How to Install Python 3.3 on Ubuntu 13.04, 12.10 and 12.04

Hello Linux Geeksters.

In this article I will show you how to install Python 3.3, the latest Python version available on Ubuntu 13.04 Raring Ringtail, Ubuntu 12.10 Quantal Quetzal and Ubuntu 12.04 Precise Pangolin.

http://www.jotlab.com/wp-content/uploads/2008/08/python.jpg

You can install Python 3.3 via PPA, on Ubuntu 12.10 and Ubuntu 12.04:

Install dependencies:

$ sudo apt-get install python-software-properties

Add the repo:

$ sudo add-apt-repository ppa:fkrull/deadsnakes

Update the repo index:

$ sudo apt-get update

Install Python 3.3:

$ sudo apt-get install python3.3

Installing Python 3.3 on Ubuntu 13.04:

Because there is no PPA for Ubuntu 13.04, we’ll do an installation from sources.

Installing the dependencies:

$ sudo apt-get install build-essential libsqlite3-dev sqlite3 bzip2 libbz2-dev

Download and compile python:

$ wget http://python.org/ftp/python/3.3.0/Python-3.3.0.tar.bz2
$ tar jxf ./Python-3.3.0.tar.bz2
$ cd ./Python-3.3.0
$ ./configure --prefix=/opt/python3.3
$ make && sudo make install

Some nice touches to install a py command by creating a symlink:

$ mkdir ~/bin
$ ln -s /opt/python3.3/bin/python ~/bin/py

Liked it? Take a second to support Geekster on Patreon!
Tagged with: , , , , , , , ,
Posted in The Linux and Unix Articles!
12 comments on “How to Install Python 3.3 on Ubuntu 13.04, 12.10 and 12.04
  1. Chris says:

    This helped me. Thanks much!

  2. K.Saravanan says:

    I installed python3.3 from deadsnakes as said – very useful.

  3. lee says:

    can you tell me will this replace the current version installed or just install another Python

    • Geekster says:

      install another python. to have only python 3.3, remove the existing python from your system before you install python 3.3:

      $ sudo apt-get remove –purge python*

      • skilo says:

        Umm that would probably be a bad idea since Ubuntu still needs python2.2 for compatibilty until they port everything over to python3.

        If you got rid of python2 you might brick your install.

  4. lee says:

    i have linux ubuntu 12.04.2 and it comes with the default 2.7.3
    i want to upgrade to 2.7.5 maybe replace 2.7.3

    The app i run picks 2.7.3 how do i tell it to use 2.7.5 thanks

  5. lee says:

    humm now i have trouble with python path changed lol

    ImportError: No module named acestreamengine.core

  6. lee says:

    i did this now

    raceback (most recent call last):
    File “/usr/lib/python2.7/site.py”, line 562, in
    main()
    File “/usr/lib/python2.7/site.py”, line 544, in main
    known_paths = addusersitepackages(known_paths)
    File “/usr/lib/python2.7/site.py”, line 271, in addusersitepackages
    user_site = getusersitepackages()
    File “/usr/lib/python2.7/site.py”, line 246, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
    File “/usr/lib/python2.7/site.py”, line 236, in getuserbase
    USER_BASE = get_config_var(‘userbase’)
    File “/usr/lib/python2.7/sysconfig.py”, line 577, in get_config_var
    return get_config_vars().get(name)
    File “/usr/lib/python2.7/sysconfig.py”, line 476, in get_config_vars
    _init_posix(_CONFIG_VARS)
    File “/usr/lib/python2.7/sysconfig.py”, line 337, in _init_posix
    makefile = _get_makefile_filename()
    File “/usr/lib/python2.7/sysconfig.py”, line 331, in _get_makefile_filename
    return os.path.join(get_path(‘platstdlib’).replace(“/usr/local”,”/usr”,1), “config” + (sys.pydebug and “_d” or “”), “Makefile”)
    AttributeError: ‘module’ object has no attribute ‘pydebug’

    any ideas?

  7. rei_29 says:

    thank you very much.

  8. srikanth says:

    while am installing python on ubuntu12.10 in first step only i got this message what can i do now
    E: Could not get lock /var/lib/dpkg/lock – open (11: Resource temporarily unavailable)
    E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

    • Geekster says:

      your dpkg has been locked, due to unsuccessful installations. to unlock it, do:

      $ sudo rm /var/lib/dpkg/lock

      Next, perform the instructions from the article

  9. zh says:

    very good

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Support LinuxG via Patreon
Support LinuxG.net on Patreon!
Subscribe

  

Subscribe to get the latest Linux news and how to guides directly on your e-mail!