用pipx安装nitropy#

本指南解释了如何用`pipx <https://pypa.github.io/pipx/>`__安装nitropy。 pipx为nitropy创建一个虚拟环境。这意味着nitropy和它的依赖项不会与你系统上安装的其他软件包冲突。

注解

**对于Windows用户:**Windows支持仍然是试验性的 – 请谨慎使用。你也可以使用预编译的二进制文件或MSI安装程序,见:doc:./windows/installation

准备工作#

Python 3.9、3.10 或 3.11#

Python 已经安装在大多数 macOS 和 Linux 系统上,或者可以从 python.org <https://python.org>`__下载。请参阅 `下载 Python 指南 了解更多信息。

琵琶#

你可以用你的系统软件包管理器或用``python3 -m ensurepip``安装pip。请参阅`pip安装指南<https://pip.pypa.io/en/stable/installation/>`__了解更多信息。

琵琶网#

在安装nitropy之前,你必须安装和配置pipx:。

python3 -m pip install --user pipx
python3 -m pipx ensurepath

请参阅`pipx安装指南<https://pypa.github.io/pipx/installation/>`__了解更多信息。

注解

对于 Linux 用户 - 目前,一个短暂的依赖关系 (oscrypto) 在某些 Linux 发行版上产生了问题。`GitHub issue<https://github.com/Nitrokey/pynitrokey/issues/431#issuecomment-1937704327>`__ 记录了当前需要的解决方法::

pipx inject --pip-args="--upgrade --force" pynitrokey "oscrypto @ git+https://github.com/wbond/oscrypto.git@1547f535001ba568b239b8797465536759c742a3"

安装#

现在你可以从pynitrokey软件包中安装nitropy:。

pipx install pynitrokey

nitropy现在可以在你的路径:。

nitropy --help

升级#

你可以用以下命令升级该软件包:。

pipx upgrade pynitrokey

故障排除#

如果你遇到问题,请通过比较``nitropy version``和GitHub上的`release list <https://github.com/Nitrokey/pynitrokey/releases>`_的输出来确保你使用了最新版本。 如果升级没有安装最新版本,你可能遇到了以下问题。

错误的Python版本#

nitropy需要Python 3.9或3.10。 如果你的默认Python安装是旧的或新的,无法更新,你必须额外安装Python 3.9,并在调用pipx时指定其Python可执行文件的名称,例如:。

$ pipx install --python python3.9 pynitrokey

不支持手臂#

目前,由于依赖性问题,最近的 nitropy 版本无法在 Arm 平台上安装 (`GitHub issue<https://github.com/Nitrokey/pynitrokey/issues/265>`__)。 作为一种变通办法,您可以在 Rosetta 终端中使用 x86 Python 安装,如`本讨论<https://stackoverflow.com/questions/71691598/how-to-run-python-as-x86-with-rosetta2-on-arm-macos-machine>`_ 中所述。)

未找到 libusb-1.0.dylib#

在macOS上运行nitropy时,你可能会看到一个错误信息,表明缺少libusb-1.0.dylib文件。 这可以通过手动安装libusb来解决,比如用homebrew:

$ brew install libusb

使用说明#

所有平台#

如果你想用Nitrokey Pro或Nitrokey存储设备使用nitropy,你还必须安装`libnitrokey <https://github.com/Nitrokey/libnitrokey>`__。

窗户#

对Windows的支持仍然是试验性的 – 请谨慎使用。

你可能必须以管理员权限运行nitropy,才能连接到设备。

基础设施#

在Linux系统上,你还需要Nitrokey的udev规则。这些规则与`libnitrokey <https://github.com/Nitrokey/libnitrokey>`__一起提供。另外,你也可以手动安装它们:。

wget https://raw.githubusercontent.com/Nitrokey/libnitrokey/master/data/41-nitrokey.rules
sudo mv 41-nitrokey.rules /etc/udev/rules.d/

更多信息见:doc:…/linux/udev

接下来的步骤#

你可以在这些指南中找到更多关于使用nitropy的信息。

  • 对于Linux: ./././nitrokey3/linux/firmware-update

  • 对于Mac: ./././nitrokey3/mac/firmware-update

  • 对于Windows: ./././nitrokey3/windows/firmware-update