How to Install openCV into Enthought python distribution on Mac
Asked Answered
C

4

7

Edit: Okay, I've generalized the question more in hopes that I get an answer. All I care about in the end is somehow installing openCV into the Enthought python distribution on a Mac computer. Any help would be greatly appreciated, the scripting isn't beyond me, but I don't have enough understanding of computer programming to figure out what these parameters mean and what needs to be different from Linux vs mac.

Hint: I've been following the guidelines found on this website, but it's for Linux and it fails 95% into 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
Cronyism answered 2/4, 2013 at 8:5 Comment(1)
What does the build log say? Are you sure the exported paths point to the correct locations?Stylograph
R
6

Although I don't have an exact answer to your question, I do suppose I have a solution to your problem. Coincidently I struggled yesterday with installing OpenCV on my mac as well. I finally simply did it by installing python and opencv using macports. That way you don't have opencv in the enthought distro, but you can simply install all the packages you use in the 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 have to make sure that when typing "python" on the command line, it does refer to the version thatyou installed using macports. You can do this by editing your ~/.bash_profile like so:

sudo open -t ~/.bash_profile

Once it has opened just see if there are references to other python distro's. You most likely have a reference to your Enthough version in there. Comment out all other python versions and add the following line:

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

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

Cheers!

Rattail answered 8/4, 2013 at 17:48 Comment(0)
D
1

The latest version of Enthought Python (Canopy) includes opencv in the package manager. Just open up Canopy, open the package manager, search for opencv and hit install.

Dhruv answered 28/5, 2014 at 10:22 Comment(0)
W
0

I did the following to get it working on OS X with Enthought (Canopy):

  1. Download opencv
  2. Copied it to /usr/local/opencc-2.4.10
  3. cd /usr/local/opencc-2.4.10
  4. mkdir release
  5. cd release
  6. export PYTHONPATH=/Users/<me>/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages:$PYTHONPATH
  7. 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 ..
  8. make
  9. sudo make install
  10. cp /usr/local/lib/python2.7/site-packages/cv* ~/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/
Windrow answered 3/2, 2015 at 17:23 Comment(0)
A
0

In my case, copying cv2.so to Canopy site-packages directory was enough.

Here is the detail and what I've tried.

  1. Download OpenCV source file from this official download link.

  2. Here is the command history I tried. To do 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
    
  3. Check the version on Python.

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

That's all. I don't know whether this is the correct way, but ,anyway , I could install OpenCV 3.1.0 on Enthought Canopy running on my mac OS X 10.11.

Avantgarde answered 15/3, 2016 at 16:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.