Installing another Python version into virtualenv

The idea is that we do not want to install a new version of Python on the system (e.g., for testing purpose), which may interfere with your entire distribution.

Instead, we want to create a virtual environment with virtualenv tool.

Let us assume you have python 2.7 and you want to play with Python 3.4

1. First, the Python executable

2. VirtualEnv setup

If you decide to install python3.4 (latest version), make sure you also have the latest version of virtualenv (1.11). I used 1.9 and got this kind of errors:

updating virtualenv with

fixed the issue.

On another computer, I got this error message:

which was due to a missing openssl library:

openssl-devel is the package to install under Fedora. maybe differently named on other distributions.

Let us now create the virtualenv, which is just like a normal directory (let us call it python3)

3. Initialise the virtualenv and testing

You should now be able to check the python version to be 3.41

Python 3.4.1 (default, Aug 16 2014, 18:35:43)
[GCC 4.7.2 20120921 (Red Hat 4.7.2-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.

This entry was posted in Python, Software development and tagged . Bookmark the permalink.

6 Responses to Installing another Python version into virtualenv

  1. Amir Eldor says:

    Cool. Thanks. Didn’t think of upgrading virtualenv.

  2. Instead of:


    And as I did not have wget, and I don’t use Homebrew, I found this super-useful:

    It totally worked.

    Thank you for this!

  3. Nooshin says:

    Thanks for your post! –python option solved my problem!

  4. Max says:

    This helps a lot, thanks.

  5. AnonymousUser says:

    Thanks Man
    Works Perfectly

  6. Anto007 says:

    This is so helpful-you’re really a great soul!

Leave a Reply

Your email address will not be published.