Search code examples
pythonvirtualenvvirtualenvwrapper

Use different Python version with virtualenv


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/"