Creating and using virtualenv
To create a virtualenv, run
1 |
virtualenv NAME_OF_VIRTUALENV |
On Ubuntu 18, this command will create virtualenv with Python 2.7.
To create virtualenv with Python 3, run
1 |
virtualenv --python=/usr/bin/python3 venv |
Here “venv” is my virtualenv name.
To activate virtialenv, go to the folder where your virtialenv folder is present, then run
1 |
source venv/bin/activate |
You will see name of your virtualenv on the command promt. To exit out of virtualenv, run
1 |
deactivate |
This can be run from any folder.