- Install virtualenv and virtualenvwrapper:
sudo pip install virtualenv
sudo pip install virtualenvwrapper
- Create virtual environment folder
mkdir ~/.environments
- 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/virtualenvwrapper.sh
- Source your bash profile
source ~/.bashrc
- Test run
mkvirtualenv
. Create new environments in python 3 with
mkvirtualenv -p `which python3` city-scrapers
-
Check your virtual environment folder for the newly created virtual environment
-
To activate the environment, type
workon your-env-name
. To exit, typedeactivate
🤔 rather than modifying the
./bashrc
and usingmkvirtualenv
, 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.