nicknochnack / TFODCourse

957 stars 924 forks source link

ImportError: No module named cv #143

Open pittebidde opened 1 year ago

pittebidde commented 1 year ago

TL:DR: If you get the Problem "ImportError: No module named cv2" or similar, it could be because your virtual enviroment does not yet have the library. you might need to install the needed libraries (opencv and numpy) locally in your virtual env. via command prompt.

I already solved this problem by myself, but since i haven't found any similar Issues in the "Issues Tab" yet, i might as well document my problem

When you create a virtual environment, your global libraries are not connected to your virtual environment setup. So if you try to import them, they won't find the library.

My solution (i dont know if it is a particulary clean one), was to:

  1. open the command promt
  2. activate your virtual environment (in my case it was windows, so i typed in ".\tfod\Scripts\activate")
  3. install the libraries locally (you need not only opencv, but also numpy because it is also used in opencv) meaning i typed into the virtual environment command line: pip install opencv-python and pip install numpy
GunSY commented 7 months ago

I am getting this error No module named 'numpy._utils' I have uninstalled and then reinstalled numpy lib, but the errors are still there. Pip list also showing I have the lib installed. error

error-1

GunSY commented 7 months ago

Can you let me know what has happened?