Last active
March 7, 2022 16:31
-
-
Save evansneath/4582716 to your computer and use it in GitHub Desktop.
Setting up and using Python3 Virtualenv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To install virtualenv via pip | |
$ pip3 install virtualenv | |
Note that virtualenv installs to the python3 directory. For me it's: | |
$ /usr/local/share/python3/virtualenv | |
Create a virtualenvs directory to store all virtual environments | |
$ mkdir somewhere/virtualenvs | |
Make a new virtual environment with no packages | |
$ virtualenv somewhere/virtualenvs/<project-name> --no-site-packages | |
To use the virtual environment | |
$ cd somewhere/virtualenvs/<project-name>/bin | |
$ source activate | |
You are now using the virtual environment for <project-name>. To stop: | |
$ deactivate |
After running pip3 install virtualenv
and then which virtualenv
, the path is to '/usr/local/bin/virtualenv
'. Does this mean that running virtualenv
is creating a python2 environment?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do I need to install Python35 before I create the virtualenv? My requirement is temporary. Test some python scripts which are designed for Python 3.5. I thought with virtualenv, I will install Python3.5 , do my thing and then delete the env.