Skip to content

Instantly share code, notes, and snippets.

@umairsd umairsd/
Last active Feb 3, 2019

What would you like to do?
Commands and tricks about Python.

Virtual Environments

Creating a virtual environment (by default, this will not include any of existing site packages):

# Python 3.6 and above
$ python3 -m venv ~/.virtualenv/<env-name>

In order to use this environment’s packages/resources in isolation, you need to “activate” it. To do this, just run the following:

$ source ~/.virtualenv/<env-name>/bin/activate
(env-name) $

To go back to system:

(env-name) $ deactivate


Once a virtual environment has been activated, install packages via

$ pip install <package-name>

To start jupyter (after activating the virtual environment):

$ jupyter notebook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.