gpt4 book ai didi

python - 无法安装 Python 包 [SSL : TLSV1_ALERT_PROTOCOL_VERSION]

转载 作者:IT老高 更新时间:2023-10-28 12:23:33 25 4
gpt4 key购买 nike

我正在尝试使用 pip 安装 Python 库,出现 SSL 错误:

~/projects/base  pre-master±  pip install xdict

Collecting xdict
Could not fetch URL https://pypi.python.org/simple/xdict/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) - skipping
Could not find a version that satisfies the requirement xdict (from versions: )
No matching distribution found for xdict

pip 版本:pip 9.0.1

如何解决这个错误?

最佳答案

升级pip如下:

curl https://bootstrap.pypa.io/get-pip.py | python

注意:如果不在虚拟环境中,您可能需要使用上述sudo python

(请注意,使用 pip 升级 pippip install --upgrade pip 也不会正确升级它。这只是一只鸡- and-egg 问题。除非使用 TLS >= 1.2,否则 pip 将不起作用。)

this detailed answer 中所述,这是由于最近 TLS 弃用了 pip。 Python.org 网站有 stopped support适用于 TLS 版本 1.0 和 1.1。

从 Python 状态页面:

Completed - The rolling brownouts are finished, and TLSv1.0 and TLSv1.1 have been disabled. Apr 11, 15:37 UTC


对于 PyCharm(虚拟环境)用户:

  1. 使用 shell 运行虚拟环境。 (把“./venv/bin/activate”换成你自己的路径)

    source ./venv/bin/activate
  2. 运行升级

    curl https://bootstrap.pypa.io/get-pip.py | python
  3. 重启你的 PyCharm 实例,并在 Preference 中检查你的 Python 解释器。

关于python - 无法安装 Python 包 [SSL : TLSV1_ALERT_PROTOCOL_VERSION],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49768770/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com