Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Basic instructions for setting up a virtual environment
  1. Install virtualenv and virtualenvwrapper:

sudo pip install virtualenv

sudo pip install virtualenvwrapper

  1. Create virtual environment folder

mkdir ~/.environments

  1. Edit your bash profile with vim to point to the newly created virtual environment folder.
echo "export WORKON_HOME=~/.environments" >> ~/.bashrc
source /usr/local/bin/
  1. Source your bash profile

source ~/.bashrc

  1. Test run mkvirtualenv. Create new environments in python 3 with
mkvirtualenv -p `which python3` city-scrapers
  1. Check your virtual environment folder for the newly created virtual environment

  2. To activate the environment, type workon your-env-name. To exit, type deactivate


This comment has been minimized.

Copy link

emmanuellyautomated commented Apr 5, 2018

🤔 rather than modifying the ./bashrc and using mkvirtualenv, one could also place their ./environments/ directory in the same directory as the project. The following steps would do the trick:

  • cd <wherever-you-cloned-it>/city-scrapers/
  • virtualenv -p python3.6 venv
  • source venv/bin/activate

Then if you run which python, it should contain the path for the current directory.


This comment has been minimized.

Copy link

cherdeman commented Apr 16, 2018

For mac users, your bash profile might be located at vi ~/.bash_profile or nano .bash_profile to use the linux text editor. If that works for you, then you'll also need to run source ~/.bash_profile.

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.