Title: macOS Mojave: Install TensorFlow and Keras for Deep Learning - PyImageSearch

URL Source: https://pyimagesearch.com/2019/01/30/macos-mojave-install-tensorflow-and-keras-for-deep-learning/

Published Time: 2019-01-30T15:00:19+00:00

Markdown Content:
[![Image 1](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20355'%3E%3C/svg%3E)](https://pyimagesearch.com/wp-content/uploads/2019/01/macos_mojave_dl_install_header.png)

Inside this tutorial, you will learn how to configure macOS Mojave for deep learning.

After you’ve gone through this tutorial, your macOS Mojave system will be ready for (1) deep learning with Keras and TensorFlow, and (2) ready for [_Deep Learning for Computer Vision with Python_](https://pyimagesearch.com/deep-learning-computer-vision-python-book/).

A tutorial on configuring Mojave has been a long time coming on my blog since the Mojave OS was officially released in September 2018.

The OS was plagued with problems from the get-go, and I decided to hold off. I’m still actually running High Sierra on my machines, but after putting this guide together I feel confident in recommending Mojave to PyImageSearch readers.

Apple has fixed most of the bugs, but as you’ll see in this guide, Homebrew (an unofficial package manager for macOS) doesn’t make everything especially easy.

If you’re ready with a fresh install of macOS Mojave and are up for today’s challenge, let’s get started configuring your system for deep learning.

Also released today is my **[Ubuntu 18.04 deep learning configuration guide with _optional_ GPU support](https://pyimagesearch.com/2019/01/30/ubuntu-18-04-install-tensorflow-and-keras-for-deep-learning/).** Be sure to check it out!

**To learn how to configure macOS for deep learning and computer vision with Python, _just keep reading_.**

Inside of this tutorial, we’ll review the **seven steps** to configuring Mojave for deep learning.

Inside of _**Step #3**_, we’ll do some Homebrew formulae kung fu to get **Python 3.6** installed.

You see, **Homebrew now _by default_ installs Python 3.7.**

This presents a challenge to us in the deep learning community because **Tensorflow does not yet officially support Python 3.7.**

The TensorFlow team is definitely working on Python 3.7 support — but if you’re running macOS Mojave you probably don’t want to twiddle your thumbs and wait until Python 3.7 support is officially released.

If you’ve run into this conundrum, then my install guide is for you.

Let’s begin!

### Step #1: Install and configure Xcode

For starters, you’ll need to get Xcode from the Apple App Store and install it. Don’t worry, it is 100% free.

[![Image 2](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20370'%3E%3C/svg%3E)](https://pyimagesearch.com/wp-content/uploads/2019/01/macos_mojave_dl_install_xcodeappstore.png)

**Figure 1:** Download Xcode for macOS Mojave prior to setting up your system for deep learning.

After Xcode has been downloaded and installed from the App Store, open a terminal and execute the following command to _accept the developer license_:

$ sudo xcodebuild -license

Press _“enter”_ then scroll to the bottom with the _“space”_ key and then type _“agree”_.

The next step is to install Apple command line tools:

$ sudo xcode-select --install

This will launch a window where you need to press _“Install_“. From there, you’ll have to accept another agreement (this time with a button). Finally, a download progress window will launch and you’ll need to wait a few minutes.

### Step #2: Install Homebrew on macOS Mojave

Homebrew (also known as Brew), is a package manager for macOS. You may already have it on your system, but if you don’t you will want to follow the commands in this section to install it.

First, we’ll install Homebrew by copying and pasting the **entire** command into your terminal:

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Next, we’ll update our package definitions:

$ brew update

Followed by updating your `~/.bash_profile` using the `nano` terminal editor (any other editor should do the trick as well):

$ nano ~/.bash\_profile

Add the following lines to the file:

\# Homebrew
export PATH=/usr/local/bin:$PATH

[![Image 3](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20378'%3E%3C/svg%3E)](https://pyimagesearch.com/wp-content/uploads/2019/01/macos_mojave_dl_install_bashprofile_homebrew.jpg)

**Figure 2:** Editing the `~/.bash_profile` to ensure that Homebrew is set up with your `PATH`. We will use Homebrew to install some of the tools on macOS Mojave for deep learning.

To save and close, press _“ctrl + o”_ (save), then _“enter”_ to keep the filename, and finally _“ctrl + x”_ (exit).

Let’s reload our profile:

$ source ~/.bash\_profile

Now that Brew is ready to go, let’s get Python 3.6 installed.

### Step #3: Downgrade Python 3.7 to Python 3.6 on macOS Mojave

I have a love-hate relationship with Homebrew. I love how convenient it is and how the volunteer team supports so much software. They do a really great job. They’re always on top of their game supporting the latest software.

The problem with Mojave is that by default Homebrew will install Python 3.7, but 3.7 is not (yet) supported by TensorFlow.

Therefore, we need to do some Kung Fu to get Python 3.6 installed on Mojave.

If you try to install Python 3.6 directly, you’ll encounter this problem:

[![Image 4](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20397'%3E%3C/svg%3E)](https://pyimagesearch.com/wp-content/uploads/2019/01/macos_mojave_dl_install_brew_sphinx-doc_dependsonpython.png)

**Figure 3:** The `sphinx-doc` + Python 3.7 circular dependency causes issues with installing Python 3.6 on macOS Mojave.

The problem is that `sphinx-doc` depends on Python 3.7, and Python 3.6.5 depends on `sphinx-doc` which depends on Python 3.7.

Reading that sentence may give you a headache, but I think you get the point that we have a _circular dependency_ problem.

_**Note:** The following steps worked for me and I tested them twice on two fresh instances of Mojave. If you know of an improved way to install Python 3.6, please let me and the community know in the comments._

Let’s take steps to fix the circular dependency issue.

First, install Python (this installs Python 3.7 which we will later downgrade):

$ brew install python3

Now we need to remove the _circular dependency._

Let’s go ahead and edit the Homebrew formulae for `sphinx-doc` as that is where the problem lies:

$ nano /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/sphinx-doc.rb

Now scroll down and remove the Python dependency by placing a `#` in front of it to comment it out:

[![Image 5](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20384'%3E%3C/svg%3E)](https://pyimagesearch.com/wp-content/uploads/2019/01/macos_mojave_dl_install_brewformulae_sphynx-doc_removepythondependency.png)

**Figure 4:** Removing the `sphinx-doc` dependency on Python 3.7. This will ultimately allow us to install Python 3.6 on macOS Mojave for deep learning.

Once you’ve added the `#` to comment this line out, go ahead and save + exit.

From there, just reinstall sphinx-doc:

$ brew reinstall sphinx-doc

Now it is time to **install Python 3.6.5.**

The first step is to unlink Python:

$ brew unlink python

And from there we can actually install Python 3.6:

$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb

From here you should check which Python is being used by querying the version:

$ which python3
/usr/local/bin/python3
$ python3 --version
Python 3.6.5

Inspect the output of the first command ensuring that you see `local/` _in between_ `/usr/` and `bin/python3` .

As our output indicates, we are now using **Python 3.6.5!**

### Step #4: Install brew packages for OpenCV on macOS Mojave

The following tools need to be installed for compilation, image I/O, and optimization:

$ brew install cmake pkg-config wget
$ brew install jpeg libpng libtiff openexr
$ brew install eigen tbb hdf5

After those packages are installed we’re ready to create our Python virtual environment.

### Step #5: Create your Python virtual environment in macOS Mojave

As I’ve stated in [other install guides on this site](https://pyimagesearch.com/opencv-tutorials-resources-guides/), virtual environments are definitely the way to go when working with Python, enabling you to accommodate different versions in sandboxed environments.

If you mess up an environment, you can simply delete the environment and rebuild it, without affecting other Python virtual environments.

Let’s install [virtualenv](https://virtualenv.pypa.io/en/latest/) and [virtualenvwrapper](https://virtualenvwrapper.readthedocs.org/en/latest/) via `pip` :

$ pip3 install virtualenv virtualenvwrapper

From there, we’ll update our `~/.bash_profile` again:

$ nano ~/.bash\_profile

Where we’ll add the following lines to the file:

\# virtualenv and virtualenvwrapper
export WORKON\_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER\_PYTHON=/usr/local/bin/python3
source /usr/local/bin/virtualenvwrapper.sh

[![Image 6](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20390'%3E%3C/svg%3E)](https://pyimagesearch.com/wp-content/uploads/2019/01/macos_mojave_dl_install_bashprofile_virtualenvwrapper.jpg)

**Figure 5:** Editing the `~/.bash_profile` again, this time to accommodate `virtualenv` and `virtualenvwrapper` tools for Python virtual environments.

Followed by reloading the profile:

$ source ~/.bash\_profile

Check for any errors in the terminal output. If `virtualenvwrapper` and Python 3.6 are playing nice together, you should be ready to create a new virtual environment.

#### Creating the `dl4cv` virtual environment on macOS Mojave

The `dl4cv` environment will house TensorFlow, Keras, OpenCV and all other associated Python packages for my deep learning book. You can of course name the environment whatever you want, but from here on we’ll be referring to it as `dl4cv` .

To create the `dl4cv` environment with **Python 3** simply enter the following command:

$ mkvirtualenv dl4cv -p python3

After Python 3 and supporting scripts are installed into the new environment, you should actually be _inside_ the environment. This is denoted by `(dl4cv)` at the beginning of your bash prompt as shown in the figure below:

[![Image 7](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20400%2098'%3E%3C/svg%3E)](https://pyimagesearch.com/wp-content/uploads/2019/01/macos_mojave_dl_install_workon_dl4cv.png)

**Figure 6:** The `workon` command allows us to activate a Python virtual environment of our choice. In this case, I’m activating the `dl4cv` environment on macOS Mojave for deep learning.

If you do not see the modified bash prompt then you can enter the following command at any time to enter the environment at any time:

$ workon dl4cv

Just to be on the safe side, let’s check which Python our environment is using and query the version once again:

$ workon dl4cv
$ which python
/Users/admin/.virtualenvs/dl4cv/bin/python
$ python --version
Python 3.6.5

Notice that the python executable is in `~/.virtualenvs/dl4cv/bin/` , our `dl4cv` virtual environment. Also **triple check** here that you’re using Python 3.6.5.

When you’re sure your virtual environment is properly configured with Python 3.6.5 it is safe to move on and install software into the environment.

Let’s continue to **Step #6**.

### Step #6: Install OpenCV on macOS Mojave

We have **two options for installing OpenCV** for compatibility with my deep learning book.

The first method (_**Step #6a**_) is by using a precompiled binary available in the Python Package Index (where pip pulls from). The disadvantage is that the [maintainer](https://github.com/skvark) has [chosen not to compile patented algorithms into the binary](https://github.com/skvark/opencv-python/issues/126).

The second option (_**Step #6b**_) is to compile OpenCV from source. This method allows for full control over the compile including optimizations and patented algorithms (“nonfree”).

I recommend going with the first option if you are a beginner, constrained by time, or if you know you don’t need patented algorithms _(DL4CV does not require the added functionality)_. The first option will require just 5 minutes.

Power users should go with the second option while allowing for about 40 to 60 minutes to compile.

#### Step #6a: Install OpenCV with pip

Ensure you’re working in the `dl4cv` environment and then enter the `pip install` command with the package name as shown:

$ workon dl4cv
$ pip install opencv-contrib-python

_**Note:**_ _If you require a specific version you can use the following syntax: `pip install opencv-contrib-python==3.4.4` ._

Congrats! You now have OpenCV installed.

From here you can skip to _**Step #7.**_

#### Step #6b: Compile and Install OpenCV

If you performed _**Step #6a**_ you should skip this option and go to _**Step #7**_.

Let’s compile OpenCV from source.

The only Python dependency required by OpenCV is NumPy, which we can install via:

$ workon dl4cv
$ pip install numpy

First, let’s download the source code:

$ cd ~
$ wget -O opencv.zip https://github.com/opencv/opencv/archive/3.4.4.zip
$ wget -O opencv\_contrib.zip https://github.com/opencv/opencv\_contrib/archive/3.4.4.zip

_**Note:**_ _You can replace `3.4.4.zip` with `4.0.0.zip` or higher if you’d like to use a different version of OpenCV. Just make sure that **both** the `opencv` and `opencv_contrib` downloads are for the_ **_same_** _version!_

Next unpack the archives:

$ unzip opencv.zip
$ unzip opencv\_contrib.zip

And rename the directories:

$ mv opencv-3.4.4 opencv
$ mv opencv\_contrib-3.4.4 opencv\_contrib

_**Note:**_ _Replace the folder name in the command with the one corresponding to your version of OpenCV._

To prepare our compilation process we use CMake.

It is very important that you copy the CMake command _**exactly**_ as it appears here, taking care to copy and past the _**entire**_ command; I would suggest clicking the _“<>”_ button in the toolbar below to expand the entire command:

$ cd ~/opencv
$ mkdir build
$ cd build
$ cmake -D CMAKE\_BUILD\_TYPE=RELEASE \\
    -D CMAKE\_INSTALL\_PREFIX=/usr/local \\
    -D OPENCV\_EXTRA\_MODULES\_PATH=~/opencv\_contrib/modules \\
    -D PYTHON3\_LIBRARY=\`python -c 'import subprocess ; import sys ; s = subprocess.check\_output("python-config --configdir", shell=True).decode("utf-8").strip() ; (M, m) = sys.version\_info\[:2\] ; print("{}/libpython{}.{}.dylib".format(s, M, m))'\` \\
    -D PYTHON3\_INCLUDE\_DIR=\`python -c 'import distutils.sysconfig as s; print(s.get\_python\_inc())'\` \\
    -D PYTHON3\_EXECUTABLE=$VIRTUAL\_ENV/bin/python \\
    -D BUILD\_opencv\_python2=OFF \\
    -D BUILD\_opencv\_python3=ON \\
    -D INSTALL\_PYTHON\_EXAMPLES=ON \\
    -D INSTALL\_C\_EXAMPLES=OFF \\
    -D OPENCV\_ENABLE\_NONFREE=ON \\
    -D BUILD\_EXAMPLES=ON ..

_**Note:** For the above CMake command, I spent considerable time creating, testing, and refactoring it. I’m confident that it will save you time and frustration if you use it exactly as it appears. **Make sure you click the “<>” button in the toolbar of the code block above to expand the code block.** This will enable you to copy and paste the **entire** command.  
_

Running CMake will take 2-5 minutes.

You should always inspect your CMake output for errors and to ensure your compile settings are set as intended.

Your output should be similar to the screenshots below which ensure that the correct Python 3 binary/library and NumPy version are utilized as well as “non-free algorithms” being on:

[![Image 8](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20436'%3E%3C/svg%3E)](https://pyimagesearch.com/wp-content/uploads/2019/01/macos_mojave_dl_install_opencv_cmake.png)

**Figure 7:** Inspecting OpenCV CMake output prior to installing deep learning frameworks on macOS.

[![Image 9](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20430'%3E%3C/svg%3E)](https://pyimagesearch.com/wp-content/uploads/2019/01/macos_mojave_dl_install_opencv_cmake_nonfree.png)

**Figure 8:** Ensuring that the OpenCV patented (“non-free”) algorithms are installed.

If your CMake output for OpenCV matches mine, then we’re ready to actually compile OpenCV:

$ make -j4

_**Note:** Most macOS machines will have at least 4 cores/CPUs. You can (and should) edit the flag above with a number according to your system’s processing specs to speedup the compile process._

[![Image 10](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20370'%3E%3C/svg%3E)](https://pyimagesearch.com/wp-content/uploads/2019/01/macos_mojave_dl_install_opencv_make.jpg)

**Figure 9:** OpenCV compilation is complete on macOS Mojave.

From there you can install OpenCV:

$ sudo make install

After installing it is necessary to sym-link the `cv2.so` file into the `dl4cv` virtual environment.

What we need to do is create a link from where OpenCV was installed into the virtual environment itself. This is known as a symbolic link.

Let’s go ahead and take care of that now, first by grabbing the name of the `.so` file:

$ cd /usr/local/python/cv2/python-3.6
$ ls
cv2.cpython-36m-darwin.so

And now let’s rename the `.so` file:

$ sudo mv cv2.cpython-36m-darwin.so cv2.opencv3.4.4.so
$ cd ~/.virtualenvs/dl4cv/lib/python3.6/site-packages
$ ln -s /usr/local/python/cv2/python-3.6/cv2.opencv3.4.4.so cv2.so

_**Note:** If you have multiple OpenCV versions ever installed in your system, you can use this same naming convention and symbolic linking method._

Finally, we can test out the install:

$ cd ~
$ python
>>> import cv2
>>> cv2.\_\_version\_\_
'3.4.4'

If your output properly shows the version of OpenCV that you installed, then you’re ready to go on to **Step #7** where we will install the Keras deep learning library.

### Step #7: Install TensorFlow and Keras on macOS Mojave

Before beginning this step, ensure you have activated the `dl4cv` virtual environment. If you aren’t in the environment, simply execute:

$ workon dl4cv

Then, using `pip` , install the required Python computer vision, image processing, and machine learning libraries:

$ pip install scipy pillow
$ pip install imutils h5py requests progressbar2
$ pip install scikit-learn scikit-image

Next, install matplotlib and **update the rendering backend**:

$ pip install matplotlib
$ mkdir ~/.matplotlib
$ touch ~/.matplotlib/matplotlibrc
$ echo "backend: TkAgg" >> ~/.matplotlib/matplotlibrc

Be sure to read this guide about _[Working with Matplotlib on OSX](https://matplotlib.org/faq/osx_framework.html)_, if you’re ever having trouble with plots not showing up.

Then, install [TensorFlow](https://www.tensorflow.org/):

$ pip install tensorflow

Followed by [Keras](https://keras.io/):

$ pip install keras

To verify that Keras is installed properly we can import it and check for errors:

$ workon dl4cv
$ python
>>> import keras
Using TensorFlow backend.
>>>

Keras should be imported with no errors, while stating that TensorFlow is being utilized as the backend.

At this point, you can familiarize yourself with the `~/.keras/keras.json` file:

[![Image 11](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20450%20187'%3E%3C/svg%3E)](https://pyimagesearch.com/wp-content/uploads/2019/01/macos_mojave_dl_install_keras_config.jpg)

**Figure 10:** The Keras configuration file allows you to set the backend as well as other settings.

Ensure that the `image_data_format` is set to `channels_last` and that the `backend` is set to `tensorflow` .

### Pre-configured environments

_**Congratulations!**_ you’ve successfully configured your macOS Mojave desktop/laptop for deep learning!

You’re now ready to go. If you didn’t grab up a tea or coffee during the installation process, now is the time. It’s also the time to find a comfortable spot to read [_Deep Learning for Computer Vision with Python_](https://pyimagesearch.com/deep-learning-computer-vision-python-book/).

**Did you have any trouble configuring your Mojave deep learning system?**

If you struggled along the way, I encourage you to re-read the instructions and attempt to debug. If you’re still struggling, you can reach out in the DL4CV companion website issue tracker (there’s a registration link in the front of your book) or by [contacting me](https://pyimagesearch.com/contact/).

I also want to take the opportunity to inform you about the pre-configured instances that come along with your book:

*   The [DL4CV VirtualBox VM](https://pyimagesearch.com/2017/09/22/deep-learning-python-ubuntu-virtual-machine/) is pre-configured and ready to go with Ubuntu 18.04 and all other necessary deep learning packages/libraries. This VM is able to run in isolation on top of your macOS operating system inside of a tool called VirtualBox. It will help you through nearly all experiments in the _Starter_ and _Practitioner_ bundles. For the _ImageNet_ bundle, a GPU is a necessity and this VM does not support GPUs.
*   My [DL4CV Amazon Machine Image](https://pyimagesearch.com/2017/09/20/pre-configured-amazon-aws-deep-learning-ami-with-python/) for the AWS cloud is freely open to the internet — no purchase required (other than AWS charges, of course). Getting started with a GPU in the cloud only takes about 4-6 minutes. For less than the price of a cup of coffee, you can use a GPU instance for an hour or two which is just enough time to complete some (definitely not all) of the more advanced lessons in DL4CV. The following environments are pre-configured: `dl4cv` , `mxnet` , `tfod_api` , `mask_rcnn` , and `retinanet` .

Azure users should consider the Azure DSVM. You can read [my review of the Microsoft Azure DSVM here](https://pyimagesearch.com/2018/03/21/my-review-of-microsofts-deep-learning-virtual-machine/). All code from one of the first releases of DL4CV in 2017 was tested using Microsoft’s DSVM. Additional configuration is required for the DSVM to support the _Bonus Bundle_ chapters of DL4CV, but other than that you won’t find yourself installing very many tools. If Azure is your preferred cloud provider, I encourage you to stick with Azure take advantage of what the DSVM has to offer.

### What's next? We recommend [PyImageSearch University](https://pyimagesearch.com/pyimagesearch-university/?utm_source=blogPost&utm_medium=bottomBanner&utm_campaign=What%27s%20next%3F%20I%20recommend).

**Course information:**  
84 total classes • 114+ hours of on-demand code walkthrough videos • Last updated: February 2024  
★★★★★ 4.84 (128 Ratings) • 16,000+ Students Enrolled

**I strongly believe that if you had the right teacher you could _master_ computer vision and deep learning.**

Do you think learning computer vision and deep learning has to be time-consuming, overwhelming, and complicated? Or has to involve complex mathematics and equations? Or requires a degree in computer science?

That’s _not_ the case.

All you need to master computer vision and deep learning is for someone to explain things to you in _simple, intuitive_ terms. _And that’s exactly what I do_. My mission is to change education and how complex Artificial Intelligence topics are taught.

If you're serious about learning computer vision, your next stop should be PyImageSearch University, the most comprehensive computer vision, deep learning, and OpenCV course online today. Here you’ll learn how to _successfully_ and _confidently_ apply computer vision to your work, research, and projects. Join me in computer vision mastery.

**Inside PyImageSearch University you'll find:**

*   ✓ **84 courses** on essential computer vision, deep learning, and OpenCV topics
*   ✓ **84 Certificates** of Completion
*   ✓ **114+ hours** of on-demand video
*   ✓ **Brand new courses released _regularly_**, ensuring you can keep up with state-of-the-art techniques
*   ✓ **Pre-configured Jupyter Notebooks in Google Colab**
*   ✓ Run all code examples in your web browser — works on Windows, macOS, and Linux (no dev environment configuration required!)
*   ✓ Access to **centralized code repos for _all_ 536+ tutorials** on PyImageSearch
*   ✓ **Easy one-click downloads** for code, datasets, pre-trained models, etc.
*   ✓ **Access** on mobile, laptop, desktop, etc.

[Click here to join PyImageSearch University](https://pyimagesearch.com/pyimagesearch-university/?utm_source=blogPost&utm_medium=bottomBanner&utm_campaign=What%27s%20next%3F%20I%20recommend)

Summary
-------

In today’s post, we configured our macOS Mojave box for computer vision and deep learning. The main pieces of software included Python 3.6, OpenCV, TensorFlow, and Keras accompanied by dependencies and installation/compilation tools.

**Python 3.7 is not yet officialy supported by TensorFlow** so you should avoid it at all costs (for the time being).

Instead, we learned how to **downgrade from Python 3.7 to Python 3.6 on macOS Mojave** and put all of the software into a **Python 3.6** virtual environment named `dl4cv` .

If you would like to put your newly configured macOS deep learning environment to good use, I would highly suggest you take a look at my new book, [_Deep Learning for Computer Vision with Python_](https://pyimagesearch.com/deep-learning-computer-vision-python-book/).

Regardless if you’re **new to deep learning** or **already a seasoned practitioner**, the book has content to help you reach deep learning mastery — [take a look here](https://pyimagesearch.com/deep-learning-computer-vision-python-book/).

**To be notified when future blog posts are published here on PyImageSearch (and grab my 17-page Deep Learning and Computer Vision Resource Guide PDF), just _enter your email address in the form below!_**

![Image 12](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20410%20567'%3E%3C/svg%3E)

#### Join the PyImageSearch Newsletter and Grab My FREE 17-page Resource Guide PDF

Enter your email address below to **join the PyImageSearch Newsletter** and **download my FREE 17-page Resource Guide PDF** on Computer Vision, OpenCV, and Deep Learning.