I have install Numpy and Scipy with virtualenv on my mac.
Today, I want to installed Opencv under virtualenv. I try:
pip install pyopencv
the terminal returned:
Could not find a version that satisfies the requirement pyopencv (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) Cleaning up... No distributions matching the version for pyopencv
I had the same problem, I couldn't get OpenCV installed in virtualenv using pip in the proper way. However this is what I have done:
Finally what I did was symlinked the folder from the "normal" python installation to the 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
So when I launch the virtualenv I have cv2 available:
(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'>
By the way I am using Python 2.7.3, OpenCV 2.4.4a, virtualenv 1.10.1 on MacOSX 10.8.5
I followed parts of this tutorial to setup opencv in virtualenv.
The cumbersome part is that everytime i create a virtual env, i need to copy opencv to the lib folder. But hey, it works!
In a nutshell..
$ 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> is the path where you have created your virtual env.
Hope this helps.
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