问题描述
我在Mac上使用virtualenv安装了Numpy和Scipy.
I have install Numpy and Scipy with virtualenv on my mac.
今天,我想在virtualenv下安装Opencv.我尝试:
Today, I want to installed Opencv under virtualenv.I try:
pip install pyopencv
终端返回:
找不到满足pyopencv要求的版本(来自版本: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)打扫干净...没有与pyopencv版本匹配的发行版
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
推荐答案
我遇到了同样的问题,我无法以正确的方式使用pip在virtualenv中安装OpenCV.但是,这就是我所做的:
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:
- 使用Homebrew(以及所有依赖项(例如numpy))安装OpenCV和Python
- 然后我安装了virtualenv并使用numpy创建了一个新的虚拟环境.
-
最后,我所做的是将文件夹从正常" python安装符号链接到virtualenv:
- Install OpenCV and Python using Homebrew (and all depenencies such as numpy)
- Then I installed virtualenv and create a new virtual environment with numpy.
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
因此,当我启动virtualenv时,我有可用的cv2:
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'>
在MacOSX 10.8.5上,我使用Python 2.7.3,OpenCV 2.4.4a,virtualenv 1.10.1的方式
By the way I am using Python 2.7.3, OpenCV 2.4.4a, virtualenv 1.10.1 on MacOSX 10.8.5
这篇关于可以在Mac Mountain Lion上的python virtualenv中安装OpenCV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!