在 nexus 上创建并使用 PyPi 代理存储库

u12*_*123 11 python pip

运行 Nexus 3 OSS 3.6.0-02 我使用本指南在 nexus 上创建了一个 pypi 代理存储库:

https://help.sonatype.com/repomanager3/pypi-repositories

具有以下信息:

Format: pypi
Type: proxy
URL: https://mynexus:9666/nexus/pypi-proxy/
Remote Storage:https://pypi.org/
Authentication: Username/Password
Run Code Online (Sandbox Code Playgroud)

现在我想安装一个包并使用上面的代理。基于:

如何让 pip 在代理服务器后面工作

这个例子:

pip install --proxy http://user:password@proxyserver:port <package>   
Run Code Online (Sandbox Code Playgroud)

我努力了:

pip install --proxy https://myuser:mypassword@mynexus:9666/nexus/pypi-proxy/ testinfra --no-cache-dir
Run Code Online (Sandbox Code Playgroud)

但我得到:

Collecting testinfra
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Invalid response from tunnel request',))': /simple/testinfra/
Run Code Online (Sandbox Code Playgroud)

我的命令行中有错误吗?或者我需要在服务器/存储库上配置什么?

Max*_*Max 13

只需在索引 URL 末尾添加 /simple

pip install --index-url https://myuser:mypassword@mynexus:9666/nexus/pypi-proxy/simple/

  • 这有效。谁能解释为什么? (2认同)

JDP*_*ham 0

尝试

pip install --index-url http://user:password@proxyserver:port <package>

根据https://pip.pypa.io/en/stable/user_guide/