Installing Python 3.4 and setting up a virtualenv

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
$ 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:

Basically you just need to make Bz2 prior to Python.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s