These steps are tested on windows 7.
-
Please download following Python packages and install them to their default locations Python 2.7. Also make the environment variable as name
Pathwith value set toC:\Python27;%PYTHON_HOME%\;%PYTHON_HOME%\Scripts\; -
Please find pip installer python file named
get-pip.pyfrom here get-pip.py. -
Press shift button and right click anywhere in the folder and select “Open command window here” and enter:
python get-pip.py. -
The pip installer will be installed and the go to
C:\Python27\Scriptsand again while holding the shift button in the Scripts folder right click to open the command window here. Enter the commandpip install dateutils. -
Stay in the same command prompt and also install
matplotlibby using the commandpip install matplotlib. -
In addition we also need imutils , so again enter the command
pip install imutils. -
Perform the command
pip install pytesseract==0.1.8. -
The Tesseract-OCR setup is also required. Go ahead and install using the defaults values.
-
An additional command has to be added in the python
.pyfile, such as:pytesseract.pytesseract.tesseract_cmd = 'C:/Program Files (x86)/Tesseract-OCR/tesseract'. -
Now, we need to install opencv.
-
Extract the opencv to C: drive and after the extraction finishes , Go to the location
C:\opencv\build\python\2.7\x86. -
And copy the file
cv2.pydfrom the locationC:\opencv34\opencv\build\python\2.7\x86and paste it to the locationC:/Python27/Lib/site-packages. -
Now check the installation by
python
import cv2
print(cv2.__version__)
The output will be 2.4.9. Congratulations! you have now successfully setup opencv and python. Enjoyed this post? Never miss out on future posts by following us