OpenCV can be installed in python virtual environment on Mac Mountain Lion

I have Numpy and Scipy with virtualenv on my mac.

Today I want to install Opencv under virtualenv. I'm trying to:

pip install pyopencv

the terminal has returned:

Could not find a version that meets the pyopencv requirement (from versions: 2.0.wr1.0.1-demo, 2.0.wr1.0.1, 2.0.wr1.1.0, 2.1.0.wr1.0.0, 2.1.0.wr1.0.1, 2.1. 0.wr1.0.2, 2.1.0.wr1.1.0, 2.1.0.wr1.2.0, 2.1.0.wr1.2.0-demo, 2.1.0.wr1.2.0) Get out ... There are no distributions corresponding to the version for pyopencv

+4
source share
2 answers

I had the same problem, I could not get OpenCV installed in virtualenv using pip correctly. However, this is what I did:

  • OpenCV Python Homebrew ( , numpy)
  • virtualenv numpy.
  • , , , "" python virtualenv:

    $ ln -s /usr/local/lib/python2.7/site-packages/cv2.so /usr/local/lib/python2.7/site-packages/cv.py ~/envs/lib/python2.7/site-packages
    

, virtualenv, cv2:

(virtualenv)localhost:~ juan$ python
Python 2.7.3 (default, Mar 18 2013, 11:14:52) 
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.27)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2
<module 'cv2' from '/Users/juan/envs/lib/python2.7/site-packages/cv2.so'>

, Python 2.7.3, OpenCV 2.4.4a, virtualenv 1.10.1 MacOSX 10.8.5

+11

opencv virtualenv.

, , env, opencv lib. , !

.

$ brew install python
$ pip install numpy
$ brew install opencv

$ cp /usr/local/lib/python2.7/site-packages/cv* <path-to-venv>/lib/python2.7/site-packages

< path-to-venv > - , env.

, .

+3

All Articles