进口PICAMERA2在Thonny IDE的CLI BOT中工作

发布于 2025-01-18 16:07:50 字数 911 浏览 3 评论 0原文

我已经成功安装了PICAMERA2,使用此我可以从CLI中运行一个脚本。脚本:

from picamera2.picamera2 import *
from time import sleep

picam2 = Picamera2()

picam2.start_preview(Preview.QTGL)

config = picam2.preview_configuration()
picam2.configure(config)

picam2.start()
sleep(5)

然后我在终端python script_name.py中运行它,并且它可以根据应有的效果。但是,当我在Thonny Ide中运行它时,脚本会返回:

modulenotfounderror:没有名为'picamera2'

的模块

为我的知识称为“ PicAmera2”,我已经在Thonny \ usr \ bin \ bin \ python3中设置了默认解释器,并也尝试了\ usr \ usr \ bin \ python \ python \ python \ python3.9\ usr \ bin \ python - 它们似乎都指向Python版本3.9.2-这也是运行Python -v ore 时在终端中显示的版本代码> python3 -v 。我想念什么或错误地做什么?

I have successfully installed picamera2 using this tutorial and I am able to run a script just fine from CLI. The script:

from picamera2.picamera2 import *
from time import sleep

picam2 = Picamera2()

picam2.start_preview(Preview.QTGL)

config = picam2.preview_configuration()
picam2.configure(config)

picam2.start()
sleep(5)

And I run it in terminal python script_name.py and it works as it should. But when I run it in Thonny IDE the script returns:

ModuleNotFoundError: No module named 'picamera2'

To my knowledge I have set the default interpreter in Thonny \usr\bin\python3 and tried also with \usr\bin\python3.9 and \usr\bin\python - they all seem to point to python version 3.9.2 - which is also the version displayed in terminal when running python -V or python3 -V. What am I missing or doing incorrectly?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

您的好友蓝忘机已上羡 2025-01-25 16:07:50
sudo apt install python3-picamera2
sudo apt install python3-picamera2
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文