When I install OpenCV 3.0 with Homebrew, it gives me the following directions to link it to Python 2.7:
If you need Python to find bindings for this keg-only formula, run:
echo /usr/local/opt/opencv3/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/opencv3.pth
While I can find the python2.7 site packages in opencv3, no python34 site packages were generated. Does anyone know how I can link my OpenCV 3.0 install to Python 3?
It's weird that there is no concise instruction for installing OpenCV 3 with Python3. So, here I make it clear step-by-step:
brew install python3
brew tap homebrew/science
Install any Python3 packages using pip3
. This will create the site-packages
folder for Python3
For example:
pip3 install numpy
Then install OpenCV3 brew install opencv3 --with-python3
site-packages
folder created in Step 2. Just run the following command to link Opencv3 to Python3:
echo /usr/local/opt/opencv3/lib/python3.5/site-packages >> /usr/local/lib/python3.5/site-packages/opencv3.pth
You may have to change the above command correpondingly to your installed Homebrew Python version (e.g. 3.4).
You need to install opencv like brew install opencv3 --with-python3
. You can see a list of options for a package by running brew info opencv3
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With