用Python连接Lifx-light

2024-05-23 14:15:55 发布

您现在位置:Python中文网/ 问答频道 /正文

从已安装的包导入类时出错

我已经安装并重新安装了lazylights 我已经将import更改为整个库,但是出现了一个错误:在创建类的实例时没有定义Lifx

from lazylights import Lifx
import time

lifx = Lifx(num_bulbs=1)  # so it knows how many to wait for when connecting

@lifx.on_connected
def _connected():
    print "Connected!"

这将产生:

ImportError: cannot import name Lifx

Tags: 实例fromimportso定义time错误it