I'm using Windows, and I'm trying to install package cv2 for python3.
I did a pip3 install opencv-python
and it reports successful:
But when I do the import cv2
from python3, it's not found and I get weird errors:
What am I doing wrong?
Join Stack Overflow to learn, share knowledge, and build your career.
I'm using Windows, and I'm trying to install package cv2 for python3.
I did a pip3 install opencv-python
and it reports successful:
But when I do the import cv2
from python3, it's not found and I get weird errors:
What am I doing wrong?
The best way is to create a virtual env. first and then do pip install , everything will work fine
Your screenshot shows you doing a pip install
from the python terminal which is wrong. Do that outside the python terminal. Also the package I believe you want is:
pip install opencv-python
Since you're running on Windows, I might look at the official install manual: https://breakthrough.github.io/Installing-OpenCV
opencv2 is ONLY compatible with Python3 if you do so by compiling the source code. See the section under opencv supported python versions: https://pypi.org/project/opencv-python
pip3 install opencv-python
. Sometimes multiple versions of python is available on a system and the default usually is python 2.7.
– zindarod
Oct 6 '17 at 17:19
import cv2
since years now, probably since version 2.0 was introduced in 2009. Maybe you are living up to your name, using the "dead" openCV 1.0? Which python and openCV versions are you using? (check python --version
in shell and for cv it usually is print(cv2.__version__)
so maybe try opencv.__version__
)
– Honeybear
Feb 21 '18 at 10:52
Make a virtual enviroment using python3
virtualenv env_name --python="python3"
and run the following command
pip3 install opencv-python
There is a problem with pylint, which I do not completely understood yet.
You can just import OpenCV with:
from cv2 import cv2
well, there was 2 issues: 1.instead of pip, pip3 should be used. 2.its better to use virtual env. because i have had multiple python version installed