Sunday, July 10, 2022

[SOLVED] Use different Python version with virtualenv

Issue

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


Answered By - Daniel Roseman
Answer Checked By - Marie Seifert (WPSolving Admin)