简体   繁体   English

使用 PIP 在 Red Hat Linux 8.2 上安装 Python 软件包不工作

[英]Install Python Packages on Red Hat Linux 8.2 using PIP not working

Working in a Corporate environment which has proxy server and thus i am setting proxy details as advised in various forum.在具有代理服务器的企业环境中工作,因此我正在按照各种论坛中的建议设置代理详细信息。 Software version details below软件版本详情如下

  • OS - Red Hat 8.2操作系统 - 红帽 8.2
  • Python Version - 3.6.8 Python 版本 - 3.6.8
  • PIP Version - pip 9.0.3 PIP 版本 - pip 9.0.3

Tried setting up environment variable尝试设置环境变量

export http_proxy=http://servername:port
export https_proxy=https://servername:port

Tried using trustedhost setting.尝试使用trustedhost 设置。 Executing below command inside python virtual environment在 python 虚拟环境中执行以下命令

pip install --proxy=<http://servername:port \
    --trusted-host pypi.python.org --trusted-host pypi.org \
    --trusted-host files.pythonhosted.org  Flask

Above command gives below Error上面的命令给出了下面的错误

Collecting Flask
  Could not find a version that satisfies the requirement Flask (from versions: )
No matching distribution found for Flask

If i remove trustedhost setting i get certification error如果我删除trustedhost 设置,我会收到认证错误

Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:897)'),)': /simple/flask/
Could not fetch URL https://pypi.python.org/simple/flask/: There was a problem confirming the ssl certificate:
    HTTPSConnectionPool(host='pypi.python.org', port=443): 
        Max retries exceeded with url: /simple/flask/ (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:897)'),)) - skipping

Kinda hard to reproduce, unfortunately, but at first glance, pypi repositories are going to be reached via HTTPS (I assume), not sure why you are explicitly specifying the schema for proxy:不幸的是,有点难以重现,但乍一看,pypi 存储库将通过 HTTPS (我假设)访问,不确定为什么要明确指定代理模式:

pip install --proxy=<http://servername:port \
    --trusted-host pypi.python.org --trusted-host pypi.org \
    --trusted-host files.pythonhosted.org  Flask

Shouldn't it actually be:实际上不应该是:

pip install --proxy=https://servername:port \
    --trusted-host pypi.python.org --trusted-host pypi.org \
    --trusted-host files.pythonhosted.org  Flask

Alternatively, you could install the packages directly from sources (download them via wget - it's easier to set proxy there, I guess).或者,您可以直接从源安装软件包(通过 wget 下载它们 - 我想在那里设置代理更容易)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM