电脑上同时有python2 和python3,python2 里有cv2,Python3里没有。
用pip3 install opencv-python 安装,提示:
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
所以先升级pip3,但是提示这个命令没用,使用命令:python3 -m pip install --upgrade pip,提示:
Successfully uninstalled pip-9.0.1
Successfully installed pip-10.0.1
再用pip3 install opencv-python,然后就可以在Python3 里import cv2 了。