简体   繁体   English

OpenCV 3.4.3与Python 3.6.7兼容吗?

[英]Is OpenCV 3.4.3 compatible with Python 3.6.7?

I am new to installing OpenCV and I want to install python 3.6.7 and a compatible OpenCV version. 我是安装OpenCV的新手,我想安装python 3.6.7和兼容的OpenCV版本。 I want to install it on 64bit windows 10 laptop. 我想将其安装在64位Windows 10笔记本电脑上。 How can I do this? 我怎样才能做到这一点?

OK, if you are using python 3.6 - 64bits in windows OS (please be sure that it appear at the begin on your "python command line") first of all you have to go to this page: " https://www.lfd.uci.edu/~gohlke/pythonlibs/ " 好的,如果您在Windows OS中使用python 3.6-64bits(请确保它出现在“ python命令行”的开头),那么首先您必须转到以下页面:“ https://www.lfd .uci.edu /〜gohlke / pythonlibs /

To install "opencv" library you first need "Numpy" library so let's download this right here: 要安装“ opencv”库,您首先需要“ Numpy”库,因此让我们在此处下载此代码: 在此处输入图片说明

let's download opencv library too: 让我们也下载opencv库:

在此处输入图片说明

There is an easy way to install these 2 libraries on windows: 1.- Unzip these files (I recommend you 7zip to do it) and in the case of numpy we will have this files: 有一种在Windows上安装这2个库的简单方法:1.-解压缩这些文件(我建议您使用7zip压缩),对于numpy,我们将具有以下文件:

在此处输入图片说明

Let's copy "Numpy" and "numpy-1.15.4+mkl.data" files (I have 1.14.0 version, don't worry about that) to this path: "Python36\\Lib\\site-packages" (the path to Python36 depends of where you installed it). 让我们将“ Numpy”和“ numpy-1.15.4 + mkl.data”文件(我有1.14.0版本,不用担心)复制到以下路径:“ Python36 \\ Lib \\ site-packages”( Python36取决于您安装的位置)。

import numpy on your python command line, if not appear any error, we have finished of installing numpy on windows 10. 在python命令行上导入numpy,如果没有出现任何错误,我们已经完成了在Windows 10上安装numpy的工作。

In the case of opencv is a little different, when we unzip .whl file of opencv, we will have these files: 如果opencv有点不同,当我们解压缩opencv的.whl文件时,我们将具有以下文件: 在此处输入图片说明

let's enter to "opencv_python-3.4.1.data" --> "data" --> "Lib" --> "site-packages". 让我们输入“ opencv_python-3.4.1.data”->“数据”->“库”->“站点包”。 and then copy all files inside "site-packages" directory to "Python36\\Lib\\site-packages" (the same directory where we paste numpy library) 然后将“ site-packages”目录内的所有文件复制到“ Python36 \\ Lib \\ site-packages”(粘贴numpy库的同一目录)

as same as in the case of numpy, import opencv on your python command line using "import cv2", if not appear any error, we have finished of installing opencv on windows 10. 与numpy相同,请使用“ import cv2”在python命令行上导入opencv,如果没有出现任何错误,我们已经在Windows 10上完成了opencv的安装。

There is another way to install .whl libraries on windows using PIP but you have to be sure that your python can be called from cmd (there is an option when you installed python called "add to path" to make this posible) also you have to have a good internet conection to prevent any posible error when installing. 还有另一种使用PIP在Windows上安装.whl库的方法,但是您必须确保可以从cmd调用python(安装python时有一个选项叫做“ add to path”,使之成为可能)。具有良好的互联网连接,以防止安装时出现任何可能的错误。 There are many tutorials in stackoverflow explaining PIP method. stackoverflow中有许多教程介绍PIP方法。 Hope this helps!. 希望这可以帮助!。

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

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