导入错误:没有名为“smbus2”的模块

问题描述

我在 VScode 上使用 Pymakr 对 Pycom L01 进行编程,该 Pycom L01 连接到多个传感器。 我正在尝试使用 smbus2 库,但我无法导入它。
我创建了一个 python 虚拟环境并使用“pip install smbus2”安装它,但是当我尝试上传草图时,输出是:

    Traceback (most recent call last):
    File "main.py",line 4,in <module>
    File "/flash/lib/bmp280.py",line 3,in <module>
    ImportError: no module named 'smbus2' 
    Pycom MicroPython 1.18.2.r1 [v1.8.6-849-e0fb68e] on 2018-12-08; LoPy with ESP32
    Type "help()" for more information.

谁能帮助我?

解决方法

可能是您没有安装 smbus2 模块。请安装它并将其导入到您的程序中。

,

解决了,这是一个菜鸟错误。 项目文件位于虚拟环境目录之外。 哦。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...