1 Star 0 Fork 1

riverstudio/pyusb

forked from mirrors_pyusb/pyusb 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

PyUSB – Easy USB access for Python

Introduction

PyUSB provides for easy access to the host machine's Universal Serial Bus (USB) system for Python 3.

Until 0.4 version, PyUSB used to be a thin wrapper over libusb. Starting with the 1.0 version, things changed considerably: now PyUSB is an API rich, backend neutral Python USB module easy to use.

Documentation

The best way to get started with PyUSB is to read the following documents:

For more detailed information, PyUSB's API documentation, as with most Python modules, is based on Python doc strings and can be manipulated by tools such as pydoc [1]:

$ python -m pydoc usb

The libusb 1.0 documentation is also a recommended read, especially when using that backend (more on this bellow).

Requirements and platform support

PyUSB is primarily developed and tested on Linux and Windows, but it should also work fine on any platform running Python >= 3.7, ctypes and at least one of the built-in backends.

PyUSB supports libusb 1.0, libusb 0.1 and OpenUSB. Of those, libusb 1.0 is currently recommended for most use cases.

On Linux and BSD, these will generally be available on the distribution's official repositories.

On macOS, libusb 1.0 can easily be installed through Homebrew:

$ brew install libusb

On Windows, pyocd/libusb-package is a convenient [2] [3] way to provide the necessary libusb 1.0 DLL, as well as a suitable PyUSB backend and a easy to use wrapper over PyUSB's find() API:

# with pure PyUSB
for dev in usb.core.find(find_all=True):
    print(dev)

# with pyocd/libusb-package
for dev in libusb_package.find(find_all=True):
    print(dev)

Alternatively, the libusb 1.0 DLL can be manually copied from an official release archive into the C:\Windows\System32 system folder, or packaged together with the complete application.

Installing

PyUSB is generally installed through pip [1]:

# the latest official release
python -m pip install pyusb

# install a specific version (e.g. 1.2.1)
python -m pip install pyusb==1.2.1

# the latest snapshop from the official git repository
python -m pip install pyusb git+https://github.com/pyusb/pyusb#egg=pyusb

Most Linux distributions also package PyUSB in their official repositories.

Getting help

If you have a question about PyUSB:

To report a bug or propose a new feature, use our issue tracker. But please search the database before opening a new issue.

Footnotes

[1] (1, 2) On systems that still default to Python 2, replace python with python3.
[2] Unlike PyUSB, pyocd/libusb-package uses the more restrictive Apache 2.0 license.
[3] While pyocd/libusb-package supports platforms other than Windows, there are advantages to sticking to a system-provided libusb, if it is available and the platform has a robust package manager (e.g. Linux, BSD, macOS with Homebrew).
Copyright 2009–2017 Wander Lairson Costa Copyright 2009–2021 PyUSB contributors Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

暂无描述 展开 收起
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/riverstudio/pyusb.git
git@gitee.com:riverstudio/pyusb.git
riverstudio
pyusb
pyusb
master

搜索帮助