我跟着这个网站(https://www.pyimagesearch.com/2015/03/30/accessing-the-raspberry-pi-camera-with-opencv-and-python/)来设置我的picamera,但我有一个问题使用 picamera 模块。我确实安装了 picamera 模块,这张图片来自 pip freeze。
你可以看到我已经有 picamera 1.13,但是当我尝试 test_image.py 时,它说“没有名为‘picamera’的模块”。
我已经卸载并安装了很多次,但错误仍然存在。我该如何解决?
test_image.py
# import the necessary packages
from picamera.array import PiRGBArray
from picamera import PiCamera
import time
import cv2
# initialize the camera and grab a reference to the raw camera capture
camera = PiCamera()
rawCapture = PiRGBArray(camera)
# allow the camera to warmup
time.sleep(0.1)
# grab an image from the camera
camera.capture(rawCapture, format="bgr")
image = rawCapture.array
# display the image on screen and …
Run Code Online (Sandbox Code Playgroud)