gpt4 book ai didi

python - 如何查看 python 的可用导入列表?

转载 作者:太空宇宙 更新时间:2023-11-03 13:42:35 24 4
gpt4 key购买 nike

问题:

从终端运行什么命令来浏览我可用于 python 的可能导入列表?


我刚买了一个带有 Raspberrian 的树莓派 b+(基于 debian 构建)。

我正在努力学习如何使用它,每个人都默认使用 python。

我从未使用过微 Controller 或 python 作为通用语言。

在我的第一个示例中,我将打开 LED。

我首先注意到的是示例顶行的import RPi.GPIO as GPIO

import RPi.GPIO as GPIO

led = 11

GPIO.setmode(GPIO.BOARD)
GPIO.setup(led,GPIO.OUT)

GPIO.output(led,GPIO.HIGH)

我不得不使用具有类似导入概念的其他语言工作,但我更好奇我怎么知道我需要导入那个 GPIO 库?对于 raspberry pi,是否有我应该知道的库的详细记录列表?

我觉得这个资源将帮助我了解这个 PI 的可能性。

最佳答案

在 Python shell 中,这将解决您的问题:

help('modules')

enter image description here

对于你的第二个问题,请检查 this关联。或者只是在 google 中快速搜索,仅此而已。

Also you can check if a module is succesfully installed or not, just import modulename in Python shell, if nothing happens, then you installed it succesfuly. If it gives an error like ImportError: No module named 'modulename' then you did something wrong when you installed that module.

关于python - 如何查看 python 的可用导入列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27751785/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com