I was recently trying to use the picamera2 library for a python project but when I try to run the program it shows the following error
I tried installing picamera2 again and it showed
The program was run inside a virtual environment. Could this be a problem with wrongly naming the module, my program was an example program from the picamera2 library documentation.
Code:
Traceback (most recent call last): File "/home/litrobo/Desktop/litdet/test.py", line 1, in <module> from picamera2 import Picamera2, PreviewModuleNotFoundError: No module named 'picamera2'
Code:
sudo apt install -y python3-picamera2Reading package lists... DoneBuilding dependency tree... DoneReading state information... Donepython3-picamera2 is already the newest version (0.3.17-1).0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Code:
from picamera2 import Picamera2, Previewimport timepicam2 = Picamera2()camera_config = picam2.create_preview_configuration()picam2.configure(camera_config)picam2.start_preview(Preview.QTGL)picam2.start()time.sleep(2)picam2.capture_file("test.jpg")
Statistics: Posted by fayisrazal — Tue Apr 09, 2024 2:11 pm