pfc
pfc

Reputation: 1910

Unable to import cv2

I tested the following command in python:

import cv2

I put it in the file b.py and run python b.py. But I met with the following error:

Traceback (most recent call last):
  File "b.py", line 1, in <module>
    import cv2
  File "/home/mypath/anaconda2/lib/python2.7/site-packages/cv2/__init__.py", line 9, in <module>
    from .cv2 import *
ImportError: libXdmcp.so.6: cannot open shared object file: No such file or directory

What's wrong with this? Thank you all for helping me!

Upvotes: 3

Views: 4652

Answers (1)

Ben10
Ben10

Reputation: 498

Did you install opencv correctly? Also what OS are you using (e.g. Windows, Linux OS X etc.)

If you're using windows - did you follow these steps?: http://docs.opencv.org/3.2.0/d5/de5/tutorial_py_setup_in_windows.html

If you are using Fedora install Opencv by typing this command into the terminal:

sudo yum install numpy opencv*

The cause of the problem may be that you haven't installed the dependencies:

  • Matplotlib
  • Numpy

Hope this helps!

Upvotes: 2

Related Questions