MST QNB MST QNB - 2 months ago 17
Python Question

How to install module and package in python

I'm trying to start with OpenCV with python. I have experience c# and I have knowledge of c++. However, I feel more comfortable with python instead of c++. I installed OpenCV then python 3.4 in visual studio 2015. At the beginning I've received an error numpy, "Module couldn't be found", thankfully, I resolved it. The I got another error cv2 "Module couldn't be found" I asked an question yesterday, but I think the question has been left away. Anyways, I'm not complaining, but I still need some help please to stat with OpenCV in python.

Installing python 3.4 Successful

Installing numpy Successful

installing matpilotlib Failed

enter image description here

installing cv2 Failed

enter image description here

can anybody help me please thanks a lot.

Answer

It's very common to install Python packages through pip today (recursive acronym for pip installs packages). However, this is not that trivial under Windows.

How to install matplotlib:

Try to open a commandline and type in pip install matplotlib. If this does not work, you'll need to do some more work to get pip running. I gave a detailed answere here: Not sure how to fix this Cmd command error?.

How to install OpenCV:

The Python OpenCV DLL must be made for your version of Python and your system architecture (or, to be more specific, the architecture your Python was compiled for).

  • Download OpenCV for your Python version (2/3)
  • Try replacing the x64 version with the x86 version
  • There are a lot of different binaries here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv. Try to get the one exactly matching your Python version and System architecture and install it via pip (cp35 means CPython version 3.5 ect.).

If you have the OpenCV .whl file matching your system configuration, do pip install file.whl.

Hope this helps!