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

时间:2019-02-06 13:12:45

标签: 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

现在,我想安装一个软件包并使用上述代理。基于:

How to get pip to work behind a proxy server

和此示例:

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

我尝试过:

pip install --proxy https://myuser:mypassword@mynexus:9666/nexus/pypi-proxy/ testinfra --no-cache-dir

但是我得到了

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/

命令行中是否存在错误?还是我需要在服务器/存储库上配置的内容?

2 个答案:

答案 0 :(得分:0)

尝试

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

每个https://pip.pypa.io/en/stable/user_guide/

答案 1 :(得分:0)

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

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