Try
pip3 install opencv-python
to get the cv2. I'm not sure when opencv-python became available. I'd been building opencv by hand, but when I looked a few weeks ago, there it was. I'm using cv2 with Python3 in a VM that's running ubuntu/trusty64.
python - Cannot find module cv2 when using OpenCV - Stack Overflow
Installed opencv but having trouble importing it
Python: No module named 'cv2' when building OpenCV 4.5.5 from sources on fresh Ubuntu 20.04
Issue "ModuleNotFoundError: No module named 'cv2'" although opencv is installed
Videos
Try
pip3 install opencv-python
to get the cv2. I'm not sure when opencv-python became available. I'd been building opencv by hand, but when I looked a few weeks ago, there it was. I'm using cv2 with Python3 in a VM that's running ubuntu/trusty64.
Try
sudo python3.5 -m pip install opencv-python
It worked for me
First do run these commands inside Terminal/CMD:
Copyconda update anaconda-navigator
conda update navigator-updater
Then the issue for the instruction below will be resolved
For windows if you have anaconda installed, you can simply do
Copypip install opencv-python
or
Copyconda install -c https://conda.binstar.org/menpo opencv
if you are on linux you can do :
Copypip install opencv-python
or
Copyconda install opencv
Link1 Link2
For python3.5+ check these links : Link3 , Link4
Update:
if you use anaconda, you may simply use this as well (and hence don't need to add menpo channel):
Copyconda install -c conda-forge opencv
This happens when python cannot refer to your default site-packages folder where you have kept the required python files or libraries
Add these lines in the code:
Copyimport sys
sys.path.append('/usr/local/lib/python2.7/site-packages')
or before running the python command in bash move to /usr/local/lib/python2.7/site-packages directory. This is a work around if you don't want to add any thing to the code.
» pip install opencv-python
Hi, I really need help. I've been crying about why it's not working for 2 hours. I know this error is very famous and common for python, but I can't fix this at all.
So, I was trying a few hand-tracking codes, with the code "import cv2" but all of the codes ended up saying ModuleNotFoundError: No module named 'cv2'.
I have done installing these codes already,
- pip3 install OpenCV-python
- pip3 install OpenCV-contrib-python
I'm using Python(Python3) 3.10(64bit), Spyder as software, Conda 4.12.0
I am quite new to python, so I may ask lots of basic questions. please help me.