Why cv2.so missing after opencv installed?

后端 未结 9 1288
你的背包
你的背包 2020-12-01 01:24

Today I installed opencv 2.4.4 to Ubuntu 12.10

But import cv2 not works.

root@-:~# python
Python 2.7.3 (default, Sep 26 2012, 21:53:58) 
[GCC 4.7.2]          


        
9条回答
  •  醉话见心
    2020-12-01 02:09

    Using raspbian on a rasberry pi I had the problem of the module not being found also. I had three versions of python (2.6, 2.7, and 3.2), be sure you are using python2.7. You can check this by running:

    python --version
    

    I found that for my case it was simply that I needed to install python-dev.

    sudo apt-get install python-dev
    

    I did Not have to remove and reinstall opencv, I tried my hardest to avoid that, knowing that it takes a few hours to complete the process.

    After installing python-dev I went to the file I built the opencv into, for me it was " ~/opencv-2.4.9/release", and told it to make

    sudo make
    

    after this I was able to find the cv2.so file. searching for it with:

    find / -name "cv2.so"
    

    at this point I found a few files. next I ran just the python to see if it could find "import" them

    python 
    >>> import cv2
    

    no errors should come up.

    >>> import numpy
    

    I have heard that numpy was necessary for opencv to run. From there I believe you should be good to run your script, if no errors come about. I hope this helps.

    The page that helped me is listed...

    http://opencv-users.1802565.n2.nabble.com/I-can-t-find-cv-so-and-cv2-so-after-compiling-td6671937.html

提交回复
热议问题