简体   繁体   English

OpenCV-python 不导入

[英]OpenCV-python not importing

I am using Pydroid to code in android.我正在使用 Pydroid 在 android 中进行编码。 Though it is an ARM machine so I downloaded OpenCV-python wheel from PiWheels and successfully installed it using pip.虽然它是一台 ARM 机器,所以我从PiWheels下载了 OpenCV-python 轮并使用 pip 成功安装它。 But i can't import OpenCV anyways.但无论如何我都无法导入 OpenCV。 Please help.请帮忙。

Here is what I tried:这是我尝试过的:

/storage/emulated/0 $ pip list
Package             Version
------------------- -----------
android             1.0
appdirs             1.4.3
astroid             2.2.5
audiostream         0.2
certifi             2019.11.28
chardet             3.0.4
cPython             0.0.5
cycler              0.10.0
Cython              0.29.13
distlib             0.3.0
filelock            3.0.12
h5py                2.9.0
idna                2.9
importlib-metadata  1.5.0
isort               4.3.15
jedi                0.13.2
Keras               2.3.1
Keras-Applications  1.0.8
Keras-Preprocessing 1.1.0
Kivy                1.11.0.dev0
kiwisolver          1.1.0
lazy-object-proxy   1.3.1
matplotlib          3.1.1
mccabe              0.6.1
numpy               1.16.2
opencv-python       4.1.1.26
pandas              0.25.1
parso               0.3.4
pip                 19.0.3
pygame-sdl2         2.1.0
pyjnius             1.1.5.dev0
pylint              2.3.1
pymongo             3.10.1
pyparsing           2.4.6
PySDL2              0.9.4
python-dateutil     2.8.1
pytz                2019.3
PyYAML              5.3
requests            2.23.0
scikit-learn        0.20.2
scipy               1.3.1
setuptools          40.8.0
six                 1.12.0
typed-ast           1.3.1
urllib3             1.25.8
virtualenv          20.0.10
virtualenv-tools    1.0
wheel               0.34.2
wrapt               1.11.1
zipp                3.1.0
/storage/emulated/0 $ python
Python 3.7.2 (default, Mar 20 2019, 14:25:26)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.7/site-packages/cv2/__init__.py", line 3, in <module>
from .cv2 import *
ModuleNotFoundError: No module     named 'cv2.cv2'
>>>
>>> import opencv-python
  File "<stdin>", line 1
    import opencv-python
                 ^
SyntaxError: invalid syntax
>>>
>>> import cv
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'cv'
>>>
>>> import opencv
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'opencv'
>>>

从 Windows 命令尝试安装- pip install opencv-python 然后导入 cv2 。

The name of the module is cv2.模块的名称是 cv2。

Try import cv2 .尝试import cv2

When I faced a similar problem in my laptop, installing opencv in a Conda environment did the job for me.当我在笔记本电脑中遇到类似问题时,在 Conda 环境中安装 opencv 为我完成了这项工作。 Try removing opencv and try reinstalling it.尝试删除 opencv 并尝试重新安装它。

Don't take this as mean, but can you reply me the link to that particular wheel file?不要认为这是刻薄的,但是你能回复我那个特定轮文件的链接吗? I am facing issues building wheels of opencv-python so it will be a great help我在构建 opencv-python 轮子时遇到了问题,所以这将是一个很大的帮助

只需尝试检查您电脑的网络摄像头,如果它要求媒体功能包,请添加该功能并重试

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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