Installing Numpy, Scipy, Opencv, Theano For Python in VS: Windows X86-64 Msi Installer"
Installing Numpy, Scipy, Opencv, Theano For Python in VS: Windows X86-64 Msi Installer"
For openCV and Theano, we will also need Python 2.7 in Visual Studio 2015 (or later). Install the Python
2.7 and Python 3.4 (or later version) in the C drive e.g., c:\Python27, c:\Python34
https://www.python.org/downloads/release/python-2712/
https://sourceforge.net/projects/opencvlibrary/
Then create a new Python Application type project in Visual Studio by choosing File->New Project as
shown below.
Then click on the custom tab to add Python 2.7 environment as shown below.
3
Then set the Python 2.7 as the default environment by clicking on the “Make this the default
environment for new projects” as shown below.
To install numpy, select pip from the dropdown for Python Environment, then type numpy and click on
the “install numpy from PyPI” as shown below.
Similarly search for scipy and install it using pip. If you get any errors in installing scipy, then download
first anaconda from the following site.
https://www.continuum.io/downloads
I chose the Python 2.7 64 bit installer. Once Anaconda is installed (It will most likely get installed in
c:\Program Files\Anaconda2 folder).
To install scipy, launch command prompt and move to the anaconda2 install folder and type the
following command.
If it still does not show up in the list of packages installed, then use pip to install it one more time. Now if
you check the Visual Studio solution explorer tab, and expand on the Python 64-bit 2.7, you will see the
scipy installed for your environment as shown below.
5
Now using pip again (from the Python Environments), search for opencv-python and install it for your
environment by clicking on the “pip install opencv-python from PYPI” as shown below.
To test if opencv has been correctly installed, type the following code in the openCVTest.py file.
import numpy as np
import cv2
cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
You can also use Python3.4 or higher to run opencv. Using pip, add the numpy and scipy libraries to the
Python 3.4 environment in Visual Studio. First, you will have to set the default environment to Python
3.4 as shown below.
Then using pip install the numpy and scipy as you did for the Python 2.7 environment. Then run the
project again, and it should work same way as under Python 3.4 (or higher)
Installing Theano:
For installing theano, the best approach is to use anaconda that you used earlier to install scipy.
First type the following command in the command prompt once you are in the install folder of
anaconda2.
conda install mingw libpython
Once above completes, then type the following command form anaconda2
Then from visual studio, use pip to search for theano and install it.
7
https://git-scm.com/download/win