【问题标题】:Create and use a PyPi proxy repository on nexus在 nexus 上创建和使用 PyPi 代理存储库
【发布时间】:2019-06-30 10:58:27
【问题描述】:

运行 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/

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

【问题讨论】:

  • 很好奇您是如何创建 pypi 代理的。我在 docker hub 上使用 nexus:oss,我得到的唯一选项是 maven1/2、nuget、npm 和 gems

标签: python pip


【解决方案1】:

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

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

【讨论】:

    【解决方案2】:

    试试

    pip install --index-url http://user:password@proxyserver:port &lt;package&gt;

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

    【讨论】:

      【解决方案3】:
      export PYPI_USER=<Username>
      export PYPI_PASSWD=<Password>
      export PYPI_HOST=mynexus:9666/nexus/pypi-proxy/simple/
      
      pip config --global set global.index-url http://$PYPI_USER:$PYPI_PASSWD@$PYPI_HOST
      pip config --global set global.trusted-host $PYPI_HOST
      
      pip install testinfra
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2021-12-19
        • 2021-05-12
        • 1970-01-01
        • 1970-01-01
        • 2012-01-11
        • 2016-08-16
        • 2017-01-02
        相关资源
        最近更新 更多