pyusb 需要安装 驱动吗?

pyusb 需要安装 驱动吗?

libusb_open returns ‘LIBUSB_ERROR_NOT_SUPPORTED’ on Windows 7

https://stackoverflow.com/questions/17350177/libusb-open-returns-libusb-error-not-supported-on-windows-7

It seems you need to install the winusb driver - libusb can get information about devices without this driver, but it cannot open them.

http://libusb.6.n5.nabble.com/LIBUSB-ERROR-NOT-SUPPORTED-td5617169.html:

On Wed, Apr 4, 2012 at 11:52 PM, Quân Phạm Minh <[hidden email]> wrote:

although I never install winusb driver but I use libusb to get information of my usb (kingston usb, and already recognize by system)

Yes that is possible. But you can not open the device and do further things. That is the confusing part for new users with regard to libusb Windows backend, and similarly for Mac OS X as well. libusb can get some basic information for device with a non-proper driver (e.g.: USB mass storage device), but will not be able to open the device without changing the driver to a supported one.

– Xiaofan

7

You can easily install the WinUSB driver or the other drivers which libusb supports (libusb-win32 and libusbK) through the use of Zadig, an application that was developed just to solve this problem. See https://zadig.akeo.ie.

One thing to keep in mind, though, is that if you replace a Mass Storage driver or HID driver (which Windows installs automatically) with WinUSB, you will only be able to access your device through libusb and won’t be able to access your device as Mass Storage or HID until you uninstall the WinUSB driver.

Finally, if you have control of the firmware for your device, it is also possible to create devices that will automatically install the WinUSB driver on Vista or later, so that users don’t have to go through a manual driver installation (this may require a connection to Windows Update for Windows 7 or earlier, but should work even without an internet connection for Windows 8 or later). See https://github.com/pbatard/libwdi/wiki/WCID-Devices.

[DISCLAIMER] I am the author of Zadig/libwi, the WCID wiki pages as well as a contributor to the libusb Windows backend.

https://github.com/pbatard/libwdi/wiki/WCID-Devices
https://zadig.akeo.ie/

(稍后补充)

### 回答1: PyUSB 是一个用于在 Python 中操作 USB 设备的库,如果在 Windows 系统上总是报错,可能是由于以下原因: 1. 缺少驱动程序:请确保 USB 设备驱动程序已正确安装。 2. 权限问题:请确保当前用户具有访问 USB 设备的权限。 3. 缺少 libusb-1.0.dll:PyUSB 依赖于 libusb-1.0.dll 文件,请确保该文件已正确安装。 如果仍然无法解决问题,建议尝试卸载并重新安装 PyUSB,或者查看 PyUSB 的文档和社区资源以获取更多帮助。 ### 回答2: 如果您在Windows上使用PyUSB时遇到错误,有几种方法可以尝试解决问题。 首先,确保您已正确安装PyUSB以及相关的驱动程序。您可以通过pip或conda等包管理工具安装PyUSB。如果您已经安装PyUSB但仍然报错,那么您可能需要安装特定于您使用的USB设备的驱动程序。您可以从设备制造商的网站下载并安装最新的驱动程序。 其次,检查USB设备和电脑之间的连接。请确保USB设备已正确连接到电脑的USB端口,并确保USB设备在其他电脑上可以正常工作。如果USB设备在其他电脑上也无法工作,那么可能是设备本身出现了问题。 另外,尝试以管理员权限运行您的Python脚本。有些USB设备需要管理员权限才能正常访问。您可以右键点击Python脚本,选择“以管理员身份运行”来尝试解决问题。 如果上述方法无效,您可以尝试使用其他USB库或方法。例如,您可以尝试使用libusb库来管理USB设备。Libusb是一个跨平台的开源库,可以用于与USB设备进行通信。 最后,如果您无法解决问题,您可以在PyUSB的GitHub页面或相关论坛上提问,寻求社区的帮助。在提问时,请提供详细的错误信息和您的操作系统、Python版本等相关信息,以便其他人帮助您解决问题。 总结来说,要解决PyUSB在Windows上报错的问题,您可以尝试安装驱动程序、检查连接、使用管理员权限运行脚本、尝试其他USB库或方法,或向社区寻求帮助。 ### 回答3: 如果在Windows上使用PyUSB时遇到了错误,可以尝试以下方法来解决问题: 1. 安装依赖:确保已安装必要的驱动程序和依赖库。通常,PyUSB需要使用libusb驱动程序来与USB设备进行通信。确保已将libusb安装到系统中,并根据操作系统的要求正确配置驱动程序。安装驱动后,可以尝试重新运行代码。 2. 更新PyUSB版本:时不时地检查并更新PyUSB版本,以便获得更好的兼容性和稳定性。在PyUSB的官方网站上可以找到最新的版本,并且可以通过pip或其他包管理工具进行安装。 3. 检查USB设备:确认USB设备是否正常工作。尝试连接其他的USB设备,如果它们可以正常工作,则可能是特定设备的问题。有时候需要安装特定的USB驱动程序来与某些设备进行通信。 4. 检查USB权限:在Windows系统中,某些USB设备可能需要管理员权限才能正常工作。尝试以管理员身份运行Python脚本或应用程序,并查看是否仍然报错。 5. 检查代码和调试:仔细检查代码以查找可能的错误或问题。确保正确地初始化和配置USB连接,并按照PyUSB的文档来使用其函数和方法。对于复杂的问题,可以使用调试工具和打印语句来跟踪程序执行过程,并找出导致错误的具体原因。 6. 搜索错误信息:如果仍然无法解决问题,可以在互联网上搜索报错信息,看看是否有其他人遇到了类似的问题,并找到了解决办法。通常,PyUSB在Windows上的错误信息并不是唯一的,其他人可能已经遇到并解决了相同的问题。 总的来说,解决PyUSB在Windows上报错的问题需要耐心和细心。通过逐步排查和尝试不同的解决方法,最终应该能够找到问题所在并修复它。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值