HiveBrain v1.2.0
Get Started
← Back to all entries
patternpythonCriticalCanonical

Use different Python version with virtualenv

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
withusevirtualenvdifferentpythonversion

Problem

How do I create a virtual environment for a specified version of Python?

Solution

NOTE: For Python 3.3+, see The Aelfinn's answer below.

Use the --python (or short -p) option when creating a virtualenv instance to specify the Python executable you want to use, e.g.:

virtualenv --python="/usr/bin/python2.6" "/path/to/new/virtualenv/"

Code Snippets

virtualenv --python="/usr/bin/python2.6" "/path/to/new/virtualenv/"

Context

Stack Overflow Q#1534210, score: 2067

Revisions (0)

No revisions yet.