0

I'm on a Raspberry Pi Zero W running Buster, and I installed OpenCV following this walkthrough. I can successfully import the module from an IPython session:

~ $ python
Python 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0] on linux
Type "help", "copywrite", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'4.1.0'
>>>

However, when I try to run scripts that import the module, I get an error:

~ $ python helloworld.py
Traceback (most recent call last):
  File "helloworld.py", line 1, in <module>
    import cv2 as cv
ModuleNotFoundError: No module named 'cv2'

Anyone know what's going on here? I'm up a creek as far as troubleshooting Linux filesystem issues goes, so any insight would be appreciated.

Edit: I forgot to mention that this Pi is being used as an embedded system, so I didn't bother setting up a virtual environment as recommended in the linked tutorial. Everything is running in the home environment.

  • Hi, wecome to SO. Just for a clarity check, the instuctions you linked asked you to open up the virtual python environment you were installing everything into via `$ workon cv`. Are you running your python command from within the virtual environment? – PeptideWitch Dec 10 '20 at 03:07
  • 1
    Sorry, I forgot to mention in the post! I didn't bother with the virtual environment part and am running everything in the home environment, which is also where I performed the installation. I've edited the post for clarity. – source4mini Dec 10 '20 at 03:15
  • 1
    Does this answer your question? [Cannot find module cv2 when using OpenCV](https://stackoverflow.com/questions/19876079/cannot-find-module-cv2-when-using-opencv) – Sabito stands with Ukraine Dec 10 '20 at 08:25

0 Answers0