As an update to my snippet on installing Python 3, the installation and setup of virtualenvs with Python 3.4 is a little different, namely because python 3.4 ships with its own virtual environment manager, Pyvenv.
1. Download the tarball and extract
$ cd /tmp $ wget https://www.python.org/ftp/python/3.4.0/Python-3.4.0.tgz $ tar -xvf Python-3.4.0.tgz
2. Run configure using the –prefix flag to specify installation location
$ ./configure --prefix=/usr/bin/python3.4
3. Make and install
$ make && sudo make install
4. Use the `pyvenv` to make a virtualenv, supplying the location of your virtualenvs
$ /usr/bin/python3.4/bin/pyvenv3.4 ~/.envs/py34
5. Activate your virtualenv
$ . ~/.envs/py34/bin/activate
6. Check Python version
$ python -V Python 3.4.0
You might want to also make a bash alias to facilitate the creation of virtual environments this way.
I have noticed that often when compiling Python 3.X from source it complains about not being able to find the Bz2 module.
Some very good instructions for solving this are here: http://justanyone.blogspot.ca/2012/07/compiling-python-with-bz2.html
Basically you just need to make Bz2 prior to Python.