1

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.

Community
  • 1
  • 1
MST QNB
  • 293
  • 2
  • 5
  • 15
  • Importing != Installing... You need to install the libraries using `pip` or similar first, before you can import them. – Dartmouth Sep 13 '16 at 15:05

3 Answers3

1

You can install matplotlib using pip (which is already installed on your machine - mentioned in your previous quesiton):

pip install matplotlib

more info: http://matplotlib.org/faq/installing_faq.html

Yaron
  • 10,166
  • 9
  • 45
  • 65
1

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!

Community
  • 1
  • 1
linusg
  • 6,289
  • 4
  • 28
  • 78
  • it's a very great answer, rich of details. That's perfect. I love it. now I've got better understanding, I think that I will resolve it soon. However I need to install freetype png. – MST QNB Sep 13 '16 at 17:11
  • 1
    Glad I could help! If you have issues with installing freetype png, you can ask a new question or comment on my answer to notify me :) – linusg Sep 13 '16 at 17:13
  • 1
    Oh, and you may find these two posts useful: http://stackoverflow.com/questions/9829175/pip-install-matplotlib-error-with-virtualenv and http://stackoverflow.com/questions/20533426/ubuntu-running-pip-install-gives-error-the-following-required-packages-can-no – linusg Sep 13 '16 at 17:15
  • 1
    @MSTQNB - Sorry for annoying with comments, but if you use the whl file from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib, I bet that the freetype png binary parts are already bundled! – linusg Sep 13 '16 at 17:18
  • Thanks a lot for all help, I installed **conda** environment and it makes my life much easier. I've started with OpenCV tutorial. – MST QNB Sep 14 '16 at 10:17
  • Good luck, and happy coding :) – linusg Sep 14 '16 at 11:17
1

You may be better off using an package such as pythonxy as a start, e.g. from https://python-xy.github.io/ , instead of installing each single package manually.

tfv
  • 6,016
  • 4
  • 36
  • 67