Install OpenCV in Windows for Python

Here I will tell you how to install OpenCV 2.4x in Windows  for Python 2.7.

Pre-requisites ( need to be downloaded ) :

Python : Download latest version of Python 2.7 from Python site.
Numpy : Download Numpy for Python 2.7 from here.
OpenCV 2.4 : Download OpenCV for windows from here.

Install:


1)  First install Python 2.7. Leave all settings as default. In that case, Python will be installed in default folder C:\Python27\


2) Now install Numpy. Again leave everything default. Numpy will find Python directory and will be installed to most appropriate folder.

3) Now double-click OpenCV.exe. It will ask for extraction folder. Give it as just C:\. It will extract all files to C:\opencv\  . Wait until everything is extracted.


4) Now copy everything in the folder C:\opencv\build\python\x86\2.7\ ( most probably, there will be only one file cv2.pyd ) and paste it in the folder C:\Python27\Lib\site-packages\


5) Now open your "Python IDLE" ( from Start > All Programmes > Python 2.7 > Python IDLE ) and just type following :
import cv2


If everything OK, it will import cv2 module, otherwise an error message will be shown.

So it is very simple procedure. Try it yourself and let me know how it goes.

NB : Even if you are using 64-bit windows, do the same procedure. ( Better don't go for 64-bit Python and Numpy )

转载于:https://www.cnblogs.com/dreamafar/p/6146011.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值