Skip to content

Instantly share code, notes, and snippets.

@rtorresve
Last active November 16, 2017 17:22
Show Gist options
  • Save rtorresve/0c5ee1567139ecc15ebe9bfe026bc14b to your computer and use it in GitHub Desktop.
Save rtorresve/0c5ee1567139ecc15ebe9bfe026bc14b to your computer and use it in GitHub Desktop.
How install python virtualenvwrapper on OSX

Install virtualenvwrapper on OSX

To install this package you previously need install python3 in your host, I use Homebrew to do it.

$ brew install python3

Later you need download and install the python pip using python3 version.

$ curl https://bootstrap.pypa.io/get-pip.py | python3

Finally you use pip3 with sudo permissions to install the virtualenvwrapper

$ sudo pip3 install virtualenvwrapper

To use it you need add some paths in your host environment, to do it please add to your .bash_profile file the next lines.

export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3
export WORKON_HOME=$HOME/virtualenvs
export PROJECT_HOME=$HOME/Devel
export VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh
source /usr/local/bin/virtualenvwrapper_lazy.sh

At the end, you can create and use your own python virtual environments, only remember that the virtualenvwrapper commands by default use python 3, by example when you make a virtualenv without define define explicitly the python version:

$ mkvirtualenv test

You will have the next output in your shell:

Using base prefix '/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/Guest/virtualenvs/test/bin/python3.6
Not overwriting existing python script /Users/Guest/virtualenvs/test/bin/python (you must use /Users/Guest/virtualenvs/test/bin/python3.6)
Installing setuptools, pip, wheel...done.
(test) $

But if you want create a virtualenv with python 2 use the next sentence:

$  mkvirtualenv test2 -p python2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment