找不到cv2模块python3 odroid

时间:2018-02-25 00:24:09

标签: python python-3.x opencv pip

我有一个使用OpenCV的python 3脚本,它不能在我的Odroid上运行。我得到的错误是Import error: No module named 'cv2'。但是当我在python 2中运行程序时,似乎工作正常。问题是,当我尝试使用pip3安装opencv-python时,我收到此错误Could not find a version that satisfies the requirement opencv-python。我不确定这是否相关,但我检查了dist-packages for python 3,它只包含virtualenv的文件并且不包含site-packages目录。当我导航到python2.7时,有一个site-packages和一个dist-packages目录,但它们都不包含opencv-python的文件。我尝试从源代码构建,但是没有用。我甚至检查了一些奇怪的原因我的IP是否被pypi.com阻止所以我运行curl https://pypi.python.com并且运行正常。我也尝试使用代理来进行pip安装,但这也导致超时错误等。我很困难,不确定pip是否是问题或其他东西被Odroid破坏了。我在使用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.

所以我使用他们指定的标志运行我得到相同但是错误但是这个,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.当我运行pip3 -Vpip -V时它说版本是9.0 .1然后我运行升级命令,它说它是最新的。

非常感谢帮助。如果我遗漏了你认为我应该放在这里的任何东西,请告诉我!

编辑:忘记提及我已尝试卸载并重新安装pip。

1 个答案:

答案 0 :(得分:0)

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.