Home

Creating a local environment

To create a virtual environment, go to your project’s directory and run venv. If you are using Python 2, replace venv with virtualenv in the below commands.

python3 -m venv env

Activating a virtual environment

Before you can start installing or using packages in your virtual environment you’ll need to activate it. Activating a virtual environment will put the virtual environment-specific python and pip executables into your shell’s PATH.

source env/bin/activate

Leaving the virtual environment

If you want to switch projects or otherwise leave your virtual environment, simply run:

deactivate

Installing Packages

You can install packages using pip since you are in your environment ex:

pip install requests

You can freeze your locally installed packages in to a requirements.txt file using -l parameter

pip freeze -l > requirements.txt