ImportError: No module named obd

ImportError: No module named obd

我已经在 python 中安装了 obd 库,使用:pip install obd。但是当我尝试导入 eventlet 时发生了这个错误:

pip install obd
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: obd in ./.local/lib/python3.6/site-packages (0.7.1)
Requirement already satisfied: pyserial==3.* in ./.local/lib/python3.6/site-packages (from obd) (3.4)
Requirement already satisfied: pint==0.7.* in ./.local/lib/python3.6/site-packages (from obd) (0.7.2)
pi@raspberrypi:~ $ python obd_hud_test.py
Traceback (most recent call last):
  File "obd_hud_test.py", line 1, in <module>
    import obd
ImportError: No module named obd

如何纠正这个错误?

P.S : 我正在使用 Python 2.7

您可以检查安装了哪些软件包:

pip list

Hightlight 特定包:

# Linux or other Unix-like systems
pip list | grep -i obd
# Windows
pip list | findstr /I obd

如果没有显示,可能是安装过程中出现问题。你应该重新安装。 要么 您应该尝试安装特定版本

pip install "obd==0.7.1"