是否可以从virtualenv运行opencv(python绑定)? [英] Is it possible to run opencv (python binding) from a virtualenv?

查看:214
本文介绍了是否可以从virtualenv运行opencv(python绑定)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将所有内容都保留在virtualenv中. OpenCV有可能吗?我可以从头开始构建,我是否只需要先设置virtualenv,然后使用特殊的编译标志来告诉它安装位置,就可以了?

I would like to keep everything contained within the virtualenv. Is this possible with OpenCV? I'm fine with building from scratch, do I just need to setup the virtualenv first then use special compile flags to tell it where to install to?

推荐答案

我发现解决方案是必须将cv2.so和cv.py复制到运行virtualenv的目录中,然后进行pip install numpy.为此,我使用了Ubuntu 12.04.

I found the solution was that I had to copy over cv2.so and cv.py to the directory running the virtualenv, then pip install numpy. To do this on Ubuntu 12.04 I used.

virtualenv virtopencv
cd virtopencv
cp /usr/local/lib/python2.7/dist-packages/cv* ./lib/python2.7/site-packages/
./bin/pip install numpy
source bin/activate
python
import cv

这篇关于是否可以从virtualenv运行opencv(python绑定)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆