编写一个超级简单的 LED 代码,遇到无法从 gpiozero 导入的问题

Writing a super simple LED code, having issues with not being able to import from gpiozero

我正在尝试将我的 raspberry pi 电子套件用于 运行 LED 程序。我的代码只是:

from gpiozero import led
from signal import pause

led = LED(4)

led.blink()

pause()

哪个抛出

Traceback (most recent call last):
  File "/home/pi/python-projects/led.py", line 1, in <module>
    from gpiozero import led
ImportError: cannot import name 'led' from 'gpiozero' (/usr/lib/python3/dist-packages/gpiozero/__init__.py)
>>> 

我已经尝试通过 sudo apt-get update && sudo apt-get install python3-gpiozero python-gpiozero 重新安装 apt,但没有任何改变。我确定它非常简单,我只是还不够了解,无法弄清楚

根据 documentation,它应该是 LED,而不是 led:

from gpiozero import LED
from time import sleep

led = LED(17)

while True:
    led.on()
    sleep(1)
    led.off()
    sleep(1)