简体   繁体   English

无法使用python 3.5安装opencv 3.1,仅适用于2.7

[英]Unable to install opencv 3.1 with python 3.5, works with 2.7 only

Today I installed python 3.5.1 with miniconda on ubuntu 15.10, it works fine. 今天我在ubuntu 15.10上安装了带miniconda的python 3.5.1,它工作正常。 I tried to install opencv 3, so I completed task 1, and 2 from this site https://help.ubuntu.com/community/OpenCV and ran this command too: sudo apt-get install python-opencv. 我尝试安装opencv 3,因此我从此站点https://help.ubuntu.com/community/OpenCV完成了任务1和2,并且也运行了以下命令:sudo apt-get install python-opencv。

After that if I tried to run python 3.5.1 with an script using opencv in terminal I got this message : Import error: no module named 'cv2' , but if I run it using sublime text, it works fine, I printed the version, so I found out sublime text uses python 2.7.10. 之后,如果我尝试在终端中使用opencv在脚本中运行python 3.5.1,则会收到以下消息: 导入错误:没有名为'cv2'的模块 ,但是如果我使用崇高的文本运行它,则可以正常工作,我打印了版本,因此我发现sublime文本使用python 2.7.10。

How can I make opencv work with python 3.5.1? 我如何使OpenCV与python 3.5.1一起工作? I did not install python 2.7.10,and I am new to linux. 我没有安装python 2.7.10,我是linux新手。 If I type python into terminal it uses 3.5.1, so thats good, and I can change the sublime text too, thats not the problem. 如果我在终端中输入python,则使用3.5.1,这很好,我也可以更改sublime文本,这不是问题。 Any help is appreciated :) 任何帮助表示赞赏:)

I managed to do it thanks to this site: https://rivercitylabs.org/up-and-running-with-opencv3-and-python-3-anaconda-edition/ . 感谢以下网站,我得以做到这一点: https : //rivercitylabs.org/up-and-running-with-opencv3-and-python-3-anaconda-edition/ The solution was : 解决方案是:

conda install -c https://conda.binstar.org/menpo opencv3

Somehow I did not think, that anaconda offers opencv binaries. 不知为何,anaconda提供了opencv二进制文件。 Great stuff 好东西

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM