0

I know there are many similar questions to this, but I can't find an answer that helps me and this is beginning to drive me nuts!

I'm trying to install OpenCV 3.0.0-beta with Python bindings but I'm having no luck. I'm using CMake in terminal using the following:

cmake −D PYTHON_EXECUTABLE=/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 \ 
−D PYTHON_PACKAGES_PATH=/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site−packages \ 
−D PYTHON_INCLUDE_DIR=/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 \ 
−D PYTHON_LIBRARY=/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib

In terminal I'm working as the root user (sudo -i) and I have unzipped opencv-3.0.0-beta to /Library as well as created a build folder using mkdir. I navigate to the build folder and run the cmake command, but I get the following error:

CMake Error: The source directory "/Library/opencv-3.0.0-beta/build/PYTHON_LIBRARY=/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib" does not exist.

I've checked all the paths and checked again. All the files are there, so I can't see what the problem is. I've looked at lots of similar issues but I'm getting nowhere fast.

I would be grateful for any help or advice.

Metaman
  • 399
  • 1
  • 3
  • 12

2 Answers2

1

I run your command on my system(yosemite 10.0.2):

cmake −D PYTHON_EXECUTABLE=/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 −D PYTHON_PACKAGES_PATH=/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site−packages −D PYTHON_INCLUDE_DIR=/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 −D PYTHON_LIBRARY=/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib ../

and I got

-- Python 2:

-- Interpreter: /usr/bin/python2.7 (ver 2.7.6)

-- Libraries: /usr/lib/libpython2.7.dylib (ver 2.7.6)

-- numpy: /Library/Python/2.7/site-packages/numpy/core/include (ver 1.9.1)

-- packages path: lib/python2.7/site-packages

--

-- Python 3:

-- Interpreter: NO

--

-- Python (for build): /usr/bin/python2.7

Community
  • 1
  • 1
cloudtex
  • 157
  • 1
  • 3
  • I guess I should just start over again. I've had a lot of problems since upgrading to Yosemite, so there is something weird going on. Thanks for helping! – Metaman Feb 11 '15 at 07:35
0

So I got it working in the end. I followed this answer and started fresh with a new clean install of python.

What is the safest way to removing Python framework files that are located in different place than Brew installs

This worked so there must have been a mess in there. However when I ran python and attempted to import opencv, I got a segmentation fault. This time I opened the cmake gui, which previously didn't work for me and checked the paths of the python bindings. They had reverted to the system version of python for some reason, so I changed them to the version in /Library, configured and generated. For once the gui app finished with no errors and I can now import opencv into my projects.

Thats 2 days of my life that I'll never get back again! :-)

Community
  • 1
  • 1
Metaman
  • 399
  • 1
  • 3
  • 12