STEP 1 – Install Xcode
- Go to – https://developer.apple.com/xcode/
- Follow the installation instructions there, should be pretty straight forward to do.
STEP 2 – Install Homebrew
1. Open the Terminal, by going to: Applications → Utilities → Terminal
2. Type the following lines. Note do not type the red numbers, they are
simply line
1 2 |
cd ~ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
3. Homebrew has now been successfully installed. We can run an update by doing:
brew install python
STEP 3 – Install the Anaconda Python Package
1. Go to: https://www.continuum.io/downloads
2. Select the OSX installer (choose Python 3.5)
3. Follow the Installation instructions, should be pretty standard, however Continuum has a guide here: https://docs.continuum.io/anaconda/install
4. Anaconda which includes Python and lots of useful libraries is now installed.
STEP 4 – Install OpenCV 3.0.0
1. Go to terminal window and type the following:
2. Type the following lines:
1 2 |
brew tap homebrew/science brew install opencv3 --with-contrib –-with-ffmpeg |
3. That’s it, OpenCV 3.0.0 would have been successfully installed.
STEP 5 – Launch an Ipython Notebook and test.
1. Go to terminal window and type the following: jupyter notebook
2. Open a new ipython notebook. By clicking new located near the top right of the screen (see red 1 below) and then under Notebooks, click on Python 2 (see red 2 below).
3. When out notebook file loads, type the 3 following lines of code as shown in the image below.
1 2 3 4 |
import cv2 import numpy import matplotlib print("Packages successfully imported") |
4. If successful, you should see the statement “Packages successfully imported” .
UPDATE:
If the above methods fail which has been happening to a lot of students due to changes in OpenCV, Anaconda etc. Please try the following alternative methods:
- From terminal type and run the following.
conda install -c https://conda.binstar.org/menpo opencv
مطالب مرتبط:
https://www.pyimagesearch.com/2016/12/19/install-opencv-3-on-macos-with-homebrew-the-easy-way/
Guide to troubleshooting Issues with Mac installs:
https://www.pyimagesearch.com/2017/05/15/resolving-macos-opencv-homebrew-install-errors/
شبکه های اجتماعی