Assuming python
and python3
are both installed, it is possible to create a virtual environment for Python 3 even if python3
is not the default Python:
virtualenv -p python3 foo
or
virtualenv --python=python3 foo
or
python3 -m venv foo
or
pyvenv foo
Actually you can create virtual environment based on any version of working python of your system. You can check different working python under your /usr/bin/
or /usr/local/bin/
(In Linux) OR in /Library/Frameworks/Python.framework/Versions/X.X/bin/
(OSX), then figure out the name and use that in the --python
or -p
flag while creating virtual environment.