简体   繁体   中英

cv2 module not found python3 odroid

I have a python 3 script which uses OpenCV which isn't working on my Odroid. The error that I'm getting is Import error: No module named 'cv2' . But when I run the program in python 2 it seems to work fine. The problem is that when I attempt to install opencv-python using pip3 , I get this error Could not find a version that satisfies the requirement opencv-python . I'm not sure if this is relevant but I've check the dist-packages for python 3 which only contains files for virtualenv and contains no site-packages directory. When I navigate to python2.7 there is a site-packages and a dist-packages directory, but neither of them contain files for opencv-python . I tried building from source as well which didn't work. I even checked if for some weird reason my IP was being blocked from pypi.com so I ran curl https://pypi.python.com and that worked fine. I also tried to pip install using a proxy but that also resulted in timeout errors and such. I'm pretty stuck and not sure if pip is the problem or something else is busted with Odroid. I also get an error that says when using sudo ,

The direcotry '/home/odroid/.cache/pip/http' or its parent direcoty is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/home/odroid/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. Check the permissions and owned of that directory. If executing pip with sudo, you may sudo's -H flag.

So i run with the flag that they specified and I get the same but error but then this, You are using pip version 8.1.1, however version 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. You are using pip version 8.1.1, however version 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. And when I run pip3 -V and pip -V it says that the version is 9.0.1 and I run the upgrade command it says its up to date.

Help would be much appreciated. If I've left anything out that you think I should put here let me know!

Edit: Forgot to mention I have tried uninstalling and re-installing pip.

The sudo -H flag sets what the $HOME environment variable should be during the sudo session, so when you are using it, it sets $HOME=/root , rather than $HOME=/home/odroid

I would run sudo -H pip3 -V and see what that gives you, as the cached wheel in the root folder may be old.

If that is the case, try sudo -H pip3 --upgrade pip && sudo -H pip3 install wheel , and then sudo -H pip3 opencv-python again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM