【问题标题】:Python 2.7 PIP install to use Artifactory as proxyPython 2.7 PIP 安装以使用 Artifactory 作为代理
【发布时间】:2020-03-15 00:37:23
【问题描述】:

我已将 Jfrog Artifactory 配置为 PIP 模块的远程仓库。当我在 Centos 7 操作系统上安装 pexcept 模块时,它使用 Artifactory 代理下载,但它给出了以下错误消息。它还试图连接 https://pypi.python.org/pypi/pip/json 网站。

有什么提示可以解决以下错误吗?另外,我如何强制 pip 命令始终使用内部 Artifacotry 代理而不直接连接任何外部存储库。

Requirement already satisfied (use --upgrade to upgrade): ptyprocess>=0.5 in /usr/lib/python2.7/site-packages (from pexpect)
Installing collected packages: pexpect
  Compiling /tmp/pip-build-bKzDu5/pexpect/pexpect/_async.py ...
    File "/tmp/pip-build-bKzDu5/pexpect/pexpect/_async.py", line 20
      transport, pw = yield from asyncio.get_event_loop()\
                               ^
  SyntaxError: invalid syntax


Successfully installed pexpect-4.7.0
Cleaning up...
Looking up "https://pypi.python.org/pypi/pip/json" in the cache
No cache entry available
Starting new HTTPS connection (1): pypi.python.org
There was an error checking the latest version of pip
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pip/utils/outdated.py", line 126, in pip_version_check
    headers={"Accept": "application/json"},
  File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 487, in get
    return self.request('GET', url, **kwargs)
  File "/usr/lib/python2.7/site-packages/pip/download.py", line 378, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 585, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.py", line 46, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/adapters.py", line 467, in send
    raise ConnectionError(e, request=request)
ConnectionError: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /pypi/pip/json (Caused by NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5c16190d10>: Failed to establish a new connection: [Errno 97] Address family not supported by protocol',))

远程站点设置:

【问题讨论】:

    标签: python pip


    【解决方案1】:

    我目前正在为此目的使用 artifactory。我确实发现有些包没有很好地解决。在更改为 https://files.pythonhosted.org 作为注册表 URL 后,一切都到位了。

    我的其他设置是

    【讨论】:

    • 谢谢,我的远程仓库设置相同。不知道为什么 PIP 连接到pypi.python.org 站点。
    • 在这种情况下,应该调整本地 pip 配置以使用本地服务器。为此,我建议您创建一个虚拟存储库并将远程添加到其中,然后将必要的添加到系统上的 pip.ini (windows) 配置文件中
    猜你喜欢
    • 2014-12-22
    • 2019-06-13
    • 2021-06-04
    • 1970-01-01
    • 1970-01-01
    • 2021-04-09
    • 2018-03-15
    • 2019-02-27
    • 2011-10-19
    相关资源
    最近更新 更多