pyusb 无法安装

发布于 2024-10-08 11:06:37 字数 819 浏览 6 评论 0原文


我正在尝试设置一些 python 脚本来控制低级 USB 功能。为了做到这一点,我发现需要安装两个库:libusb 和 pyusb。我首先安装了 libusb 并且成功了,但现在 pyusb (版本 1.0.0)遇到了问题。

我尝试使用推荐的命令(在 pyusb 文件夹中)安装 pyusb: python setup.py install
从运行此命令后的输出来看,它看起来已经安装没有问题。但是当我尝试运行我的简单程序时,它给出了一个错误:

  File "/Users/michael/Desktop/usb.py", line 1, in 
    import usb.core
ImportError: No module named core

My python script tries to import usb.core, so if there's no module, then pyusb didn't install.

Other people have had the same problem. Their approach was to uninstall the old versions of pyusb, but to my knowledge, I have no previous installations.

如何安装 pyusb 库?

提前致谢。我非常感谢您的帮助。
--米

I'm trying to setup some python scripts for controlling low-level USB functions. In order to do this, I've found that two libraries need to be installed: libusb and pyusb. I first installed libusb and was successful, but now I'm having problems with pyusb (version 1.0.0).

I tried to install pyusb using the recommended command (in the pyusb folder): python setup.py install
From the output after running this command, it looks like it has installed with no problems. But when I try to run my simple program it gives an error:

  File "/Users/michael/Desktop/usb.py", line 1, in 
    import usb.core
ImportError: No module named core

My python script tries to import usb.core, so if there's no module, then pyusb didn't install.

Other people have had the same problem. Their approach was to uninstall the old versions of pyusb, but to my knowledge, I have no previous installations.

How would it be possible to install the pyusb library?

Thanks in advance. I really appreciate your help.
--m

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

笑脸一如从前 2024-10-15 11:06:37

尝试:

sudo apt-get install python-pip
sudo pip install --upgrade pyusb

这对我有用。

Try:

sudo apt-get install python-pip
sudo pip install --upgrade pyusb

It worked for me.

美人如玉 2024-10-15 11:06:37

您决定将其命名为 usb.py 的脚本将被导入以代替 pyusb 提供的 usb 包。重命名您的脚本。

You script, which you have decided to call usb.py, is being imported in place of the usb package provided by pyusb. Rename your script.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文