Home>
python3.7.4
python super beginner.
Thank you in advance.
In interactive mode
Program code
img1 = cv2.imread ("lena.jpg", 0)
When I run, I get the following error:
>>>img1 = cv2.imread ("lena.jpg", 0)
Traceback (most recent call last):
File "<stdin>", line 1, in<module>
NameError: name 'cv2' is not defined
How can I get rid of this error?
Add
import cv2
Whenis executed,
>>>import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in<module>
ModuleNotFoundError: No module named 'cv2'
and a new error appeared.
-
Answer # 1
-
Answer # 2
The error is where cv2 came from.
If it is a variable, it must be defined in advance.
Related articles
- about errors in python input
- i have a question about runtime errors and exception handling in python
- about how to eliminate the error when updating python with raspbian (buster)
- javascript - [react] i want to eliminate syntax errors
- python - about errors in google colaboratory
- python - about errors in deep learning
- python - about errors when using the camera module of raspberry pie
- python 3x - python i want to eliminate the error when outputting the average temperature in tokyo
- python - twitteroauth doesn't fix simple errors
- about errors when drawing graphs in python
- a large number of errors when installing the python library
- python - twitterapi i want to resolve errors when acquiring follower information
- i want to eliminate duplicate strings in python
- python - i want to eliminate an infinite loop
- python - how to solve errors when learning with svm
- python - warning system errors using discordpy/if statements
- python - resolving len type errors
Cub2 is probably not imported
Execute
import cv2
before