How To Install OpenCV and Keras in Python 3.6

Akshay L Chandra
2 min readJul 8, 2018

--

This is a helper post for my other tutorial posts.

OpenCV Installation via Terminal

To install OpenCV, open a terminal window (aka a command prompt window for Windows users) and use conda to install the latest version (v3) using the following command:

conda install opencv3

You should then get an installation prompt asking to proceed (y/n)? Select yes to proceed with the installation.

Troubleshooting Note: If the above installation command did not work for your computer, try accessing opencv3 through a specific source and use one of the the following commands:

conda install -c conda-forge opencv=3.2.0

or

conda install -c menpo opencv3=3.2.0

Verify OpenCV Installation

To verify that you have OpenCV correctly installed, let’s check in a python environment. Again in your terminal window, type the following:

> python
> import cv2
> print (cv2.__version__)

It should print out the latest stable version.

Keras Installation Via Terminal

To install Keras, open a terminal window (aka a command prompt window for Windows users) and use conda to install the latest version using the following command:

conda install -c conda-forge keras

You should then get an installation prompt asking to proceed (y/n)? Select yes to proceed with the installation.

Troubleshooting Note: If the above installation command did not work for your computer, try some other ways given in the Keras documentation here.

Verify Keras Installation

To verify that you have OpenCV correctly installed, let’s check in a python environment. Again in your terminal window, type the following:

> python
> import keras

It should display the message “using TensorFlow backend…”

--

--