Resolving the "Cannot find module cv2" Error with OpenCV
The issue encountered when attempting to import cv2 in a Python program on Raspberry Pi stems from a path misconfiguration. Despite having successfully installed OpenCV version 2.4.5 using a specific installation script, the program cannot locate the cv2 module at runtime.
To address this problem, execute the following commands in Terminal/CMD:
conda update anaconda-navigator conda update navigator-updater
As an alternative, consider the following installation instructions to resolve the issue:
For Windows (with Anaconda):
pip install opencv-python
For Windows (without Anaconda):
conda install -c https://conda.binstar.org/menpo opencv
For Linux:
pip install opencv-python
For Linux (alternative):
conda install opencv
For further information, refer to the provided links:
For Python 3.5 , refer to the following links:
Update:
If using Anaconda, the following command can also be used instead of adding the menpo channel:
conda install -c conda-forge opencv
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3