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

标签 python import raspberry-pi

问题:

从终端运行什么命令来浏览我可用于 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/

相关文章:

python - 为什么我的 .txt 文件中只出现前三行 -?! Raspberry Pi - 温度湿度读数

python - 如何为 PyInstaller 创建 Hook 模块?

python - 在 ubuntu 16.04 中安装 pyodbc 和 pymssql 时遇到障碍

python - 如何将列表元素附加到 Pandas 系列中的每一行?

eclipse - 在eclipse pydev中导入numpy时出现"Undefined variable from import"

javascript - 如何正确从 gl-matrix.js 导入?

python - 试图让 Django 在 VPS 上运行,但我一直遇到 "Invalid option to WSGI daemon process definition"

java - java中如何从其他包导入图标

android - 在 Android 上有一个初始化脚本,可以在定义的 URL 上启动浏览器全屏吗?

c++ - Raspberry 交叉编译的链接器错误