How to Install OpenCV for Python on Windows 10 - Tutorial For Beginners 2


OpenCV Python Tutorial For Beginners 2 - How to Install OpenCV for Python on Windows 10




 How to Install OpenCV for Python on Windows 10 - Tutorial For Beginners 2

In this Articale on OpenCV Python Tutorial For Beginners, I am going to show How to Install OpenCV on Windows with Python.



Hey guys welcome in the next Article on openCV tutorials for beginners using Python.

in this article I'm going to show you how you can install OpenCV for python on your Windows operating system.

So obviously you need to install Python on your Windows operating system in order to install OpenCV for python.

So first of all I'm going to show you how you can install Python on your Windows operating system and then we will see how to install OpenCV using Python now if you have already installed Python on your Windows operating system you can skip about five minutes  and go directly to the point where I am going to show you how you can install OpenCV for python.

 How to Install OpenCV for Python on Windows 10 - Tutorial For Beginners 2

so let's get started so first of all open your favorite browser on your Windows 10 operating system and then search for Python and the first link which will appear here will be from python.org e so we are going to click on that link and once this Python Waddy website is open you just need to scroll down a little until you see this downloads section and you can see at the time of making this Image python 3.7.0 is the latest version of python available.

 so we are going to click on this link which says python 3.7.0 and you will be redirected to this page which says python 3.7.0 and now i'm going to scroll down until i see the files here and you will see there are various kinds of installer available here we are going to install the python using the executable installer.



 How to Install OpenCV for Python on Windows 10 - Tutorial For Beginners 2

 so we are going to choose this option which says windows x86 - 64 .executable installer and now I will wait for this executable to be downloaded and once this executable is downloaded you just need to click on this Exe file and I'm going to minimize the browser here.

 How to Install OpenCV for Python on Windows 10 - Tutorial For Beginners 2



so you can see pythons 3.7.0 setup window has been started and on the first window you will see two options here one is Install Now and other is customized installation so what we are going to choose is this option which says customize installation because when you choose this Install Now option we'll be installed at this part which I don't want to use you can see it's a long path which I don't want to remember so I will use this option which says customize installation and I will also check this option which says add Python 3.72 path.



 How to Install OpenCV for Python on Windows 10 - Tutorial For Beginners 2

so now let's click on customize installation and next you will see this optional feature window and you can see there are some optional feature which this Python installer will install.

for example documentation pip it will install which is a Python package manager Idol IDE Python test suit and other feature it's going to install so I'm going to leave everything as default.

  How to Install OpenCV for Python on Windows 10 - Tutorial For Beginners 2


and then I'm going to click Next and now this next window will open which says advanced option here I'm going to check this option which says install for all users and I'm going to leave other checkboxes as checked and then you will see this section here which says customize install location
so I want to install Python on my C directory so what I'm going to do is I'm going to open the Windows Explorer and I'm going to go to the C directory here and once the C directory is open I'm going to right click here and I'm going to create a new directory.


  How to Install OpenCV for Python on Windows 10 - Tutorial For Beginners 2


and I'm going to name this a directory as Python and then I'm going to press enter and this part I'm going to give here in the customize install location.


  How to Install OpenCV for Python on Windows 10 - Tutorial For Beginners 2



so I'm going to just give this part which says C colon slash Python and then backslash Python 3 7 3 7 here means that we are going to install 3.7 version of Python.



 so now python will be installed at this location on my computer and then i'm going to click on the install button here.
.

 How to Install OpenCV for Python on Windows 10 - Tutorial For Beginners 2

and then you will see the installation will start and it will be finished in a few seconds so just wait for the installation to complete and after some time i can see this message which say setup was successful.



 How to Install OpenCV for Python on Windows 10 - Tutorial For Beginners 2

so i'm going to click on this close button which is going to close this installer

  How to Install OpenCV for Python on Windows 10 - Tutorial For Beginners 2



so now in order to check whether python is installed on our windows operating system or not we are going to search for python here and you will see a few options here one is this python 3.7 terminal other is idle so first of all we are going to click on this option which says Python 3.7 64-bit which is going to open this kind of terminal.



  How to Install OpenCV for Python on Windows 10 - Tutorial For Beginners 2



 so this is a Python terminal and here we can for example print something so I'm going to just write print and in the parenthesis and in between the double quotes I can just  write hello world and then press Enter which is going to in return print hello world that means Python 3.7 terminal is  working.


  How to Install OpenCV for Python on Windows 10 - Tutorial For Beginners 2


so I'm going to close this terminal now and once again I'm going to search for Python here and this time I'm going to select this option which says idle ok so just select this option which says idle and in the parenthesis Python 3.7 64 bit

  How to Install OpenCV for Python on Windows 10 - Tutorial For Beginners 2


so this idle is an IDE which comes with Python installation at the time of installation we have chosen this option to install idle that's why we can see this option here and also this is an interactive shell so you can once again write a print and inside the parentheses you can just write for example once again   hello world and then press ENTER and it's going to give you this kind of output here so now python interactive shell is working and idle ide is also working so I'm going to close this idle IDE

  How to Install OpenCV for Python on Windows 10 - Tutorial For Beginners 2




now I want to check whether Python is working using my command prompt or not




  How to Install OpenCV for Python on Windows 10 - Tutorial For Beginners 2

so I'm going to right click on this Windows button and then I'm going to click on command prompt and here I'm going to first of all write Python and then press ENTER and you can see this python option is working now even on your command prompt right so here also you can just write print and inside the parenthesis you can just print hello world     and then press ENTER and it prints    hello world in return




  How to Install OpenCV for Python on Windows 10 - Tutorial For Beginners 2

now one python is installed on your Windows 10 operating system we are going to install OpenCV using pip now pip is automatically installed on your Windows operating system with the Python installation

so you don't need to separately install pip on your Windows operating system it comes automatically with your Python installation
 so to verify this first of all I'm going to check the python version so you can just give this command python - - version and then you can check the pip version so you can just give this command pip - - version so just give this command and it's going to give you the version of pip which is installed on your Windows operating system

 so to install OpenCV using pips you just need to give this command pip install open CV - Python and I'm going to press ENTER so you can see open CV related packages are downloading now so now open CV Python package is installed using pip on my Windows operating system
 now you will observe one more thing here and that is numpy package will be automatically installed with your OpenCV python package
so now once open CV python package is installed we can verify it by just opening our Python shell so I'm going to just give python command to open the Python shell and then here I'm going to just write import CV - okay so once you give this command it should not give you any error and if this import gives you error that means open CV is not correctly installed on your operating
now after importing you can just check the version of open CV which you have installed using C v2 dot underscore underscore version underscore underscore and then press ENTER and it's going to give you the version of open CV which is installed on your opera system and in our case this is for point zero point zero at the time of making this article




 How to Install OpenCV for Python on Windows 10 - Tutorial For Beginners 2

 Now you can check the same by writing your code inside a Python file also so here I have opened my Visual Studio code editor and I have already created sample dot py file and here also I'm going to import the CV to package first of all and then I'm going to print the version of CV to using this print statement so I'm going to just write C v2 dot underscore underscore version underscore underscore and then save this script and to open the terminal inside Visual Studio code you can just press control shift P and then type toggle integrated terminal so just type toggle integrated terminal and then click on this first option which says toggle integrated terminal this is going to open the terminal inside your Visual Studio code editor so here you can run your python script using the python command so python and then name of the script which is sample dot py in my case and then press enter and it's also going to give you the version of OpenCV which is installed on your operating system so this is how you can install OpenCV for python on your Windows operating system I hope you've enjoyed this article .

And I will see you in the next Article