Skip to content

Instantly share code, notes, and snippets.

@washal
Last active November 20, 2015 09:26
Show Gist options
  • Select an option

  • Save washal/08c65a65a64a3427f2bd to your computer and use it in GitHub Desktop.

Select an option

Save washal/08c65a65a64a3427f2bd to your computer and use it in GitHub Desktop.
Use Virtual Environments in Python3
#Ref: http://chrisstrelioff.ws/sandbox/2014/09/16/python_3_4_on_ubuntu_14_04_using_virtual_environments.html
# Create a virtual environment directory to store all virtual environments
$ mkdir somedir/venvs
# Create virtual environment using python 3
mkvirtualenv <project_name> -p /usr/bin/python3
# It automatically brings you into the virtual env for that project
(project_name)$
# To exit from the VE
(project_name)$ deactive
$
# Enter into the project virtual environment
$ workon <project_name>
(project_name)$
# NOTE: To ensure environment variable is set at login, you can add the below lines to .bashrc
export WORKON_HOME='/rootdir/somedir/ve'
source /usr/local/bin/virtualenvwrapper.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment