$ brew install python3
You should then check which version is installed
$ python3 --version
Once Python3 is installed, it comes with Pip3
Next we run the following command:
$ pip3 install virtualenv
$ pip3 install virtualenvwrapper
Usually, you should have a directory where all you virtualenvs reside but in the event that you do not, run the following command:
$ mkdir ~/.virtualenvs
Open your .bashrc and add this directory to the path
export WORKON_HOME=~/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
Activate these changes by sourcing bash anew
$ source ~/.bashrc
We are now ready to use Python3 and virtualenv wrapper but we need to know on which path it is to use it. Run the following command to find out.
$ which python3
The result most probably looks something like this /usr/local/bin/python3
. With this we are ready to create virtualenvs
$ mkvirtualenv --python=/usr/local/bin/python3 mynewvirtualenvname
It shoould now be active
$ (mynewvirtualenvname) ➜ ~
You can deactivate it by simply running the deactivate command:
$ (mynewvirtualenvname) ➜ ~ deactivate
I hope you found this useful. Cheers.