Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Python3.7 setup on Mac 10.14 (Mojave)
  1. Install Python 3.7.x from or via homebrew.
$ brew install python3   # Installed at /usr/local/Cellar/python3

Check that python3 has been installed by running it at the terminal:

$ python3
>>> Python 3.7.2
  1. Download from and install (this should already be installed if python was installed from or homebrew):
$ curl -O
$ sudo python3
  1. Install virtualenv and virtualenvwrapper
$ sudo -H pip3 install virtualenv
$ sudo -H pip3 install virtualenvwrapper --ignore-installed six
  1. Add the following to your ~/.bash_profile to load virtualenvwrapper then run bash -l
# Location of python virtual environments
export WORKON_HOME=$HOME/.virtualenvs

if [ -e /usr/local/bin/ ]; then
  source /usr/local/bin/
  1. Create your virtual enviornment named py3
$ mkvirtualenv --python=`which python3` py3
* To install all modules: pip3 install -r requirements.txt

Installing opencv with python3.7

$ brew update
$ brew install opencv@3 --with-python3   # Add --with-contrib if you want the contrib modules
$ ln -s /usr/local/Cellar/opencv/3.4.5/lib/python3.7/site-packages/cv2/python-3.7/ /usr/local/lib/python3.7/site-packages/

You may have to export PYTHONPATH:

export PYTHONPATH=$PYTHONPATH:/usr/local/Cellar/opencv/3.4.5/lib/python3.7/site-packages

If you installed a previous version of opencv and no longer need it, remove it:

brew cleanup opencv


$ python3
In[1]: import cv2
In[2]: cv2.__version__
Out[2]: '3.4.5'

Install these modules from Github as their py3 support is currently not published on PyPI. Their master branch works with Python3.7

Set your locale in an environment variable in ~/.bash_profile

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

Type bash -l in your terimal to run the updated bash_profile.
Now, install the modules:

$ pip3 install git+git://
$ pip3 install git+git://
$ pip3 install git+git://
$ brew install llvm
$ brew link llvm --force
$ pip3 install numba

Test code from numba

Copy link

m2b commented Aug 28, 2017

Did you get this to work on MacOS Sierra? I cannot figure out this issue. I am pulling my hair!
ImportError: dlopen(/usr/local/lib/python3.6/site-packages/scipy/sparse/linalg/isolve/, 2): Symbol not found: ___addtf3
Referenced from: /usr/local/lib/python3.6/site-packages/scipy/sparse/linalg/isolve/../../../.dylibs/libquadmath.0.dylib
Expected in: /usr/lib/libSystem.B.dylib

Copy link

nicemustard commented Sep 26, 2017

when i type:
$ mkvirtualenv --python=which python3.6 py3

i get:
-bash: mkvirtualenv: command not found

virtualenv and virtualwrapper are already there. would you be able to help at all?

Copy link

quintendewilde commented Jan 2, 2018

I have the same as @nicemustard.
any solution?

And when running out of the Env and in python via commandline I get this.
When running any of the examples. Also the same after installing the pip installation. which was succesfully.

    from docopt import docopt
ModuleNotFoundError: No module named 'docopt'

I also pip install docopt but no succes.

Copy link

alyssaq commented Jan 9, 2018

@nicemustard @BLCKPSTV
I forgot to add that virtualenvwrapper needs to be enabled in your bash_profile. Ive added it as (4) in install-python3-6-pip3

Copy link

7stud commented Jan 28, 2018

Install Python 3.6.x from

Easier said than done. I'm running OSX 10.13.2, and I tried to install python3.6.4 from the tar file Python3.6.4.tgz. The README.rst file says:

Build Instructions

On Unix, Linux, BSD, macOS, and Cygwin::

make test
sudo make install

This will install Python as python3.

But the make test step (or the make step depending on the ./configure flags you use) hangs forever on a line that says test_asyncio. I filed a bug report.

Copy link

luvpreetsingh commented Jul 16, 2018

Hey, brew install python3 now installs python3.7, not python3.6

Copy link

haijohn commented Jul 17, 2018

how to install python3.6 instead of python3.7 using brew

Copy link

sellers commented Jul 18, 2018

@haijohn, you could brew install pyenv, and then pyenv install 3.6.5 for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment