没有名为“picamera"的模块 [英] No module named ‘picamera'

查看:76
本文介绍了没有名为“picamera"的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我关注了这个网站(https://www.pyimagesearch.com/2015/03/30/accessing-the-raspberry-pi-camera-with-opencv-and-python/) 来设置我的 picamera,但是我的 picamera 模块有问题.我确实安装了picamera模块,这张图片来自pip freeze.

I followed this website (https://www.pyimagesearch.com/2015/03/30/accessing-the-raspberry-pi-camera-with-opencv-and-python/) to set my picamera, but I have a problem with the picamera module. I did install the picamera module, and this picture is from pip freeze.

https://imgur.com/a/3y5b2rO

你可以看到我已经有 picamera 1.13,但是当我尝试 test_image.py 时,它说没有名为‘picamera’的模块".

You can see I have picamera 1.13 already, but when I try test_image.py, it says "No module named ‘picamera'".

https://imgur.com/a/XMEXwXJ

我已经卸载并安装了很多次,但错误仍然存​​在.我该如何解决这个问题?

I have uninstalled and installed many times, but the error still exist. How do I fix this?

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 wait for a keypress
cv2.imshow("Image", image)
cv2.waitKey(0)

推荐答案

对于 python3,你必须在下面的命令中尝试这个.记住你需要在主目录中打开终端.

for python3 you have to just try this below commands.keep in mind that you need to open terminal in home directory.

sudo -H apt install python3-picamera
sudo -H pip3 install --upgrade picamera[array]

让我知道它是否有效!

这篇关于没有名为“picamera"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆