加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 在Ubuntu 12.04中为Python安装OpenCV. dist-packages或

发布时间:2020-12-14 01:04:04 所属栏目:Linux 来源:网络整理
导读:按照 here给出的步骤,我已经完成了安装过程,但Python(IDLE)给了我一个ImportError.指南建议: Python may return to you an error like “ No module named cv ” The trouble is that the python module is installed in /usr/local/lib/python2.6/site-pac
按照 here给出的步骤,我已经完成了安装过程,但Python(IDLE)给了我一个ImportError.指南建议:

Python may return to you an error like “No module named cv” The trouble is that the python module is installed in /usr/local/lib/python2.6/site-packages. But,on Debian and on Ubuntu,Python only looks in /usr/local/lib/python2.6/dist-packages

You can fix it using three ways (Use only one of those,the first is the best):

  1. move the cv.so file from the site-packages to the dist-packages:

    sudo mv /usr/local/lib/python2.6/site-packages/cv.so /usr/local/lib/python2.6/dist-packages/cv.so

但是,2.7和3.2的站点包和dist-packages都是空的.

出了什么问题,我该如何解决?

解决方法

我通过使用软件中心再次安装所有软件包和依赖项来解决问题. OpenCV Python绑定直接来自我第二次使用的软件中心的OpenCV 2.3和Python 2.7.

3.2的OpenCv python绑定不适用于12.04.它们仅为Raring(Ubuntu 13.04)开发.因此,解决方案是使用backports,或在Python 2.7上使用OpenCv

Backports也存在问题,因为它们仅适用于32位OS系统而不是64位.

因此,在Ubuntu上运行OpenCV Python的唯一安全稳定的方法似乎是在Python 2.7上使用OpenCV 2.3

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读