Ubuntu 14.04 by default uses Python 2.7 and 3.4. If you want to install Python 3.3, in my case because various Openstack projects that maintain 3.3 compatibility.
I had a hard time finding what I would consider an official means. These are a third party PPA steps. I welcome comments for any other ways to install multiple Python environments.
$ sudo apt-get install -y python-software-properties
$ sudo add-apt-repository -y ppa:fkrull/deadsnakes gpg: keyring `/tmp/tmpuljbio98/secring.gpg' created gpg: keyring `/tmp/tmpuljbio98/pubring.gpg' created gpg: requesting key DB82666C from hkp server keyserver.ubuntu.com gpg: /tmp/tmpuljbio98/trustdb.gpg: trustdb created gpg: key DB82666C: public key "Launchpad Old Python Versions" imported gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1)
NOTE: The add repo command prompts for a user response without -y.
$ sudo add-apt-repository ppa:fkrull/deadsnakes This PPA has older and newer Python versions for Ubuntu. The packages in the official archives generally don't go back all that far, but people might still need to develop and test against these old Python interpreters. There also was a time when Google App Engine still ran on Python 2.5, but nobody likes to talk about that. A disclaimer first: I do not guarantee any kind of updates. In particular, I shed all responsibility for security issues in these packages. If you want to use them in a security-or-otherwise-critical environment (say, on a production server), you do so at your own risk. For Python 2.7 updates for supported Ubuntu releases, see my dedicated 2.7 PPA: https://launchpad.net/~fkrull/+archive/ubuntu/deadsnakes-python2.7 Reporting Issues ================ Issues can be reported in the master issue tracker at: https://bitbucket.org/fk/deadsnakes-issues Donations ========= If you like what I'm doing here, you can show your appreciation by donating: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=TTTFWBJ2DZK6E Supported Ubuntu Versions ========================= Supported — Precise, Trusty, Utopic Generally, I try to support Ubuntu releases until their official End-of-Life. Supported Python Versions ========================= Currently supported releases — 2.3, 2.4, 2.5, 2.6, 2.7, 3.1, 3.2, 3.3, 3.4 Basically, if an Ubuntu version doesn't have an official package for a specific major Python version (be it "any more" or "yet"), look for one in this PPA. However, for a given Python major release, don't expect to find newer point releases if there is already an older point release in the official Ubuntu repositories (i.e., if an Ubuntu release has a package for Python 2.6.4, I won't provide a package with 2.6.5 for that Ubuntu release): newer Python point releases shouldn't add new features or change behaviour, so they're rather pointless (no pun intended) for development and testing; conversely, if that Python point release has a bug that is fixed in a newer release, that's still an issue with the original package and should be taken up with the Ubuntu or Debian maintainer of the package. Besides, making these update packages externally to the original repositories is a bit of a pain. As an exception, I have updated Python 2.7 packages for several Ubuntu releases in a separate PPA: https://launchpad.net/~fkrull/+archive/ubuntu/deadsnakes-python2.7 Supported Python Packages ========================= Using third-party modules packaged for Debian or Ubuntu with the Python interpreters from this repository is a bit of a mixed bag. For Python 2, Python modules from the official repositories will not work, as a consequence of how Python packaging works in Debian. For Python 3 on the other hand, all pure-Python module packages at least should be available; compiled extension modules will not work however. In general, you're better off installing Python modules using the common Python packaging tools rather than the system package manager. For an introduction into the Python packaging ecosystem and its tools, refer to the Python Packaging User Guide .  https://packaging.python.org More info: https://launchpad.net/~fkrull/+archive/ubuntu/deadsnakes Press [ENTER] to continue or ctrl-c to cancel adding it gpg: keyring `/tmp/tmp1rda6tjx/secring.gpg' created gpg: keyring `/tmp/tmp1rda6tjx/pubring.gpg' created gpg: requesting key DB82666C from hkp server keyserver.ubuntu.com gpg: /tmp/tmp1rda6tjx/trustdb.gpg: trustdb created gpg: key DB82666C: public key "Launchpad Old Python Versions" imported gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) OK
$ sudo apt-get update
$ sudo apt-cache show python3.3 Package: python3.3 Priority: optional Section: python Installed-Size: 255 Maintainer: Felix Krull
Architecture: amd64 Version: 3.3.6-4+trusty1 Suggests: python3.3-doc, binutils Depends: python3.3-minimal (= 3.3.6-4+trusty1), libpython3.3-stdlib (= 3.3.6-4+trusty1), mime-support Filename: pool/main/p/python3.3/python3.3_3.3.6-4+trusty1_amd64.deb Size: 136098 MD5sum: 924f7fcd5e84d0938c1ae8e8c5b7f226 SHA1: 8e34edec87644b7c620a98a5f2e5fa54f4cbba67 SHA256: 44bc419559695dd78f9b5e37a9bf7ce586c4d3b1922e896bb15ed9d243cb578c Description-en: Interactive high-level object-oriented language (version 3.3) Python is a high-level, interactive, object-oriented language. Its 3.3 version includes an extensive class library with lots of goodies for network programming, system administration, sounds and graphics. Description-md5: d77f2abf1b0095e2e7bf5e21022e3d54 Multi-Arch: allowed Original-Maintainer: Matthias Klose
And now you can install the specific version.
$ sudo apt-get install -y python3.3 python3.3-dev
At this time I now have 3 different versions as well as the python and python3 aliases.
$ python --version Python 2.7.6 $ python3 --version Python 3.4.0 $ python2.7 --version Python 2.7.6 $ python3.3 --version Python 3.3.6 $ python3.4 --version Python 3.4.0
This enabled me to now use Python 3.3. for my Openstack tox testing which at first pass produces the same error as Python 3.4
$ tox -epy33 --notest
[…] taken from Ronald Bradford’s Blog Entry, as these were more recent than this entry on AskUbuntu, which if I had to guess would be where […]