As of version 3.3, python includes a package named venv. However that package doesn't provide the same functionalities as the traditional virtualenv package.
venv allows creating virtual environments only for the version of python it's installed for.
virtualenv allows creating virtual environments for different versions of python by providing the path to the binary.
Creating virtual envs for different versions of python:
So assuming one has python 2.7 and python 3.6 installed in /path/to/ and wants to create the virtual env named respectively env-py36 with python 3.6 and env-py27 with python 2.7
# create a virtual env with python3's venv :
/path/to/python36/bin/python3 -m venv /my/python-venvs/env-py36
. /my/python-venvs/env-py36/bin/activate
# we're now running python 3's "env-py36" virtual env, we want to install the "virtualenv" package
pip install virtualenv
deactivate
# now use virtualenv to create a virtual environment for python 2.7
/my/python-venvs/env-py36/bin/virtualenv --python=/path/to/python27/bin/python /my/python-venvs/env-py27
Using python 3.3+ venv
Python 3.3+ :
/path/to/python3/bin/python3 -m venv ENV_DIR
Python 3.3 to 3.5 (deprecated in 3.6+) :
/path/to/python3/bin/pyvenv ENV_DIR
Sources:
--pythonflag, so something else about your environment or invocation is wrong here. Can you give the error message? - Cody Piersallconda install python=3.5inside of my activated virtual environment thinking that this would change the python dist inside my env but instead it changed the local version. I changed back to 3.6 but now I run into this problem but the answer there does not work for me. oh god what did I do - Danoramminicondachanged the path var to/Users/.../miniconda3/bin:which is incompatible with the python versionvirtualenvwas using. Removing/Users/.../miniconda3/binfrom the path fixes the issue but then I can't useconda... I know this is now a separate issue but any ideas how I can add it back to the path without messing up virtualenv? - Danoram