ImportError:没有名为canard的模块

2024-09-23 22:20:18 发布

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

我正在尝试运行鸭式库的示例,给出here

from canard import can
from canard.hw import cantact

dev = cantact.CantactDev("/dev/cu.usbmodem14511")

dev.start()
while True:
      print(dev.recv())

我已经通过pip命令安装了lib,在执行pip list时可以看到它。然而,当我执行上面的程序时,我得到了错误-ImportError: No module named canard为什么会发生这种情况?我在ubuntu上

pip freeze输出-

appdirs==1.4.4
apturl==0.5.2
bcrypt==3.1.7
blinker==1.4
Brlapi==0.7.0
CANard==0.2.2
certifi==2019.11.28
chardet==3.0.4
chrome-gnome-shell==0.0.0
Click==7.0
colorama==0.4.3
command-not-found==0.3
cryptography==2.8
cupshelpers==1.0
dbus-python==1.2.16
defer==1.0.6
distlib==0.3.1
distro==1.4.0
distro-info===0.23ubuntu1
duplicity==0.8.12.0
entrypoints==0.3
.......
.......

Tags: pipfromdevimport示例herecanhw