How to install openCV in ethought python distribution on Mac

Edit: Well, I have summarized the question more in the hope that I will get an answer. In the end, all I care about is somehow install openCV into the Enthought python distribution on a Mac. Any help would be greatly appreciated, the script does not go beyond me, but I do not have enough understanding of computer programming to understand what these options mean and what should be different from Linux and Mac.

Hint: I followed the recommendations that were found on this website, but this is for Linux, and it does not execute 95% of the "make" command: http://pyetc.wordpress.com/2013/01/09/installing- the-enthought-python-distribution-with-opencv /

export EPDPATH=$HOME/.local/epd-7.3-2-rh5-x86_64 # prepend the EPD bin dir to your path to make your shell prefer the EPD python interpreter to the system python interpreter export PATH=$EPDPATH/bin:$PATH # also the python packages should be searched in the correct location export PYTHONPATH=$EPDPATH/lib/python2.7/site-packages 

Followed by:

 mkdir build cd build cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX:PATH=$HOME/.local -D PYTHON_EXECUTABLE:FILEPATH=$EPDPATH/bin/python -D PYTHON_INCLUDE_DIR:PATH=$EPDPATH/include/python2.7 -D PYTHON_LIBRARY:FILEPATH=$EPDPATH/lib/libpython2.7.so -D PYTHON_LIBRARY_PATH:UNINITIALIZED=$EPDPATH/lib/libpython2.7.so -D PYTHON_NUMPY_INCLUDE_DIR:PATH=$EPDPATH/lib/python2.7/site-packages/numpy/core/include -D PYTHON_PACKAGES_PATH:PATH=$EPDPATH/lib/python2.7/site-packages -D SPHINX_BUILD:FILEPATH=$EPDPATH/bin/sphinx-build -D PYTHONINTERP_FOUND=1 -D BUILD_PYTHON_SUPPORT=ON -D INSTALL_PYTHON_EXAMPLES:BOOL=ON .. make make install 
+7
source share
4 answers

Although I do not have an exact answer to your question, I believe that I have a solution to your problem. Coincidence I struggled yesterday with installing OpenCV on my mac as well. I finally just did this by installing python and opencv using macports. This way you don't have opencv in the enthought distribution, but you can just install all the packages you use in enthought distro using macports.

So just install macports from this page: http://www.macports.org/install.php

Then do:

 sudo port install python27 # (or any other version you want) sudo port install py27-numpy sudo port install opencv +python27 

and, of course, you can install any other packages you need:

 sudo port install py27-scipy sudo port install py27-ipython etc. 

Finally, you must make sure that when you type "python" at the command line, this refers to the version you installed using macports. You can do this by editing your ~ / .bash_profile file as follows:

 sudo open -t ~/.bash_profile 

Once it opens, just look for links to other python distributions. Most likely you have a link to your version of Enthough. Comment on all other python versions and add the following line:

 export PATH=/opt/local/bin:/opt/local/sbin:$PATH 

This should do the trick: having opencv working with python, while still having all the scientific modules you like.

Hooray!

+6
source

The latest version of Enthought Python (Canopy) includes opencv in the package manager. Just open Canopy, open the package manager, find opencv and click install.

+1
source

I did the following to make it work with OS X with Enthought (Canopy):

  • Download opencv
  • Copied it to / usr / local / opencc -2.4.10
  • cd /usr/local/opencc-2.4.10
  • mkdir release
  • cd release
  • export PYTHONPATH=/Users/<me>/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages:$PYTHONPATH
  • cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_NEW_PYTHON_SUPPORT=ON -D BUILD_EXAMPLES=ON -D PYTHON_LIBRARY=/Users/<me>/Library/Enthought/Canopy_64bit/System/lib/libpython2.7.dylib ..
  • to do
  • sudo make install
  • cp /usr/local/lib/python2.7/site-packages/cv* ~/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/
0
source

In my case, it was enough to copy the cv2.so directory to Canopy site-packages.

Here is the detail and what I tried.

  • Download the OpenCV source file from this official download link .

  • Here is the team history I tried. For this, you may need to install cmake .

     $ pwd /Users/kei/Downloads/opencv-3.1.0 $ mkdir release $ cd release $ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local .. $ make -j4 $ sudo make install $ cp /usr/local/lib/python2.7/site-packages/cv2.so /Users/kei/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages 
  • Check out the Python version.

     import cv2 print cv2.__version__ # will print '3.1.0' 

It's all. I do not know if this is correct, but in any case, I could install OpenCV 3.1.0 on Enthought Canopy, running on my Mac OS X 10.11.

0
source

All Articles