Nexus pypi 存储库 "Could not find a version that satisfies the requirement"

Nexus pypi repository "Could not find a version that satisfies the requirement"

使用 nexus 3,我使用“https://pypi.org" as remote storage. The url of the repository is "http://localhost:8081/repository/pypi/”配置了代理 python 存储库。

然后我使用 pip 使用 nexus 存储库安装软件包,在 $HOME/.config/pip/pip.conf 我有以下配置:

[global]
index = http://localhost:8081/repository/pypi/pypi
index-url = http://localhost:8081/repository/pypi/stable
trusted-host = localhost

现在当我 运行 pip search pexpect 它工作正常:

User for localhost:8081: someuser
Password: 
pexpect (4.7.0)                  - Pexpect allows easy control of interactive console applications.
pexpect-serial (0.0.4)           - pexpect with pyseriat
...

但是当我 运行 pip install pexpect 我得到以下错误:

Collecting pexpect
User for localhost:8081: someuser
Password: 
  Could not find a version that satisfies the requirement pexpect (from versions: )
No matching distribution found for pexpect

我是否需要在 pip.conf 或我的 nexus 存储库中进行额外配置?

你应该改变这个:

[global]
index = http://localhost:8081/repository/pypi/pypi
index-url = http://localhost:8081/repository/pypi/stable
trusted-host = localhost

为此(将 stable 换成 simple):

[global]
index = http://localhost:8081/repository/pypi/pypi
index-url = http://localhost:8081/repository/pypi/simple
trusted-host = localhost

作为替代方案,您可以在不修改配置的情况下安装软件包:

如果您的 Nexus PyPi 存储库是 http://localhost:8081/repository/pypi/:

# To install, mind trailing /simple
pip install -i http://localhost:8081/repository/pypi/simple pexpect

# To search, mind trailing /pypi
pip search -i http://localhost:8081/repository/pypi/pypi pexpect

来源:Nexus docs