Error: [ModuleNotFoundError: No module named 'cv2' ]

1. Problems

Error: ModuleNotFoundError: No module named 'cv2'

Caused by not installing a required module

Two, solve the problem

Open the physical machine terminal: run the following command

pip install opencv-python   
pip install opencv-contrib-python 

After the installation is successful, it will display: Successfully and version number

Just re-run the code

3. Summary

This kind of error [ModuleNotFoundError: No module named '———'] is
generally caused by the lack of required modules.
'——': refers to the modules that need to be installed, and the installation can solve the problem.

4. Inspirational words for life

Life will always be a little bitter, and the days will eventually be a little sweet. However, there are still many times when we will be sad in the dark. Because we are afraid that we will not find the way ahead. I remembered a fable: the old monk asked the young monk: "If you take one step forward and you die, what should you do?" The young monk said without hesitation: "I will go to the side." On the road of no one, our hands can remove the thorns on the road, our shoulders can carry the burden of life, and our sweat can exchange for the hope of tomorrow. If you are wronged, you can cry loudly, but after crying, you still have to look forward. After going through the predicament, one day, we go to the street in the early morning again, and we will find that there is still a road beside the road. Come on, everything will pass, everything will be fine!

Life is short, I learn Python!

Guess you like

Origin blog.csdn.net/CHENG15234944691/article/details/123815983