警告:pip配置了需要TLS / SSL的位置,但是Python中的ssl模块不可用

铃木和昭(Kazuaki Suzuki):

我想在Google Cloud Compute Engine上使用Python3.8.x。

首先,我使用gcloud命令创建了一个实例

gcloud compute instances create \
  pegasus-test \
  --zone=asia-northeast1-b \
  --machine-type=n1-highmem-8 \
  --boot-disk-size=500GB \
  --image-project=ml-images \
  --image-family=tf-1-15 \
  --maintenance-policy TERMINATE --restart-on-failure

默认情况下,Python版本是3.5.3。

python3 -V
Python 3.5.3

因此,我升级了Python。我遵循了这条指令。谷歌云计算引擎更改为python 3.6

cd /tmp
wget https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tgz
tar -xvf Python-3.8.3.tgz
cd Python-3.8.3
./configure
sudo apt-get install zlib1g-dev
sudo make
sudo make install

我没有错误信息。现在,我有了Python3.8.3。

python3 -V
Python 3.8.3

接下来,我想使用PEGASUS。https://github.com/google-research/pegasus

git clone https://github.com/google-research/pegasus
cd pegasus
export PYTHONPATH=.
pip3 install -r requirements.txt

然后,我收到一条错误消息。

WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting absl-py (from -r requirements.txt (line 1))
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("
Can't connect to HTTPS URL because the SSL module is not available.")': /simple/absl-py/
  WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("
Can't connect to HTTPS URL because the SSL module is not available.")': /simple/absl-py/
  WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("
Can't connect to HTTPS URL because the SSL module is not available.")': /simple/absl-py/
  WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("
Can't connect to HTTPS URL because the SSL module is not available.")': /simple/absl-py/
  WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("
Can't connect to HTTPS URL because the SSL module is not available.")': /simple/absl-py/
  Could not fetch URL https://pypi.org/simple/absl-py/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(
host='pypi.org', port=443): Max retries exceeded with url: /simple/absl-py/ (Caused by SSLError("Can't connect to HTTPS URL beca
use the SSL module is not available.")) - skipping
  ERROR: Could not find a version that satisfies the requirement absl-py (from -r requirements.txt (line 1)) (from versions: non
e)
ERROR: No matching distribution found for absl-py (from -r requirements.txt (line 1))
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='
pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SS
L module is not available.")) - skipping

我检查了点子的版本。

pip3 -V
pip 19.2.3 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)

因此,我尝试升级点子。pip3 install --upgrade pip然后,我收到此错误消息。

WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Ca
n't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Ca
n't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Ca
n't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Ca
n't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Ca
n't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='
pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SS
L module is not available.")) - skipping
Requirement already up-to-date: pip in /usr/local/lib/python3.8/site-packages (19.2.3)
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='
pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SS
L module is not available.")) - skipping

因此,接下来我使用pip代替pip3我输入pip install -r requirements.txt

这就是结果。

Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: absl-py in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 1)) (0.9.0)
Requirement already satisfied: mock in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 2)) (3.0.5)
Requirement already satisfied: numpy in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 3)) (1.16.6)
Collecting rouge-score
  Downloading rouge_score-0.0.4-py2.py3-none-any.whl (22 kB)
Collecting sacrebleu
  Downloading sacrebleu-1.3.7.tar.gz (26 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-HCHhuX/sacrebleu/setup.p
y'"'"'; __file__='"'"'/tmp/pip-install-HCHhuX/sacrebleu/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f
.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/
pip-install-HCHhuX/sacrebleu/pip-egg-info
         cwd: /tmp/pip-install-HCHhuX/sacrebleu/
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-HCHhuX/sacrebleu/setup.py", line 65, in <module>
        version = get_version(),
      File "/tmp/pip-install-HCHhuX/sacrebleu/setup.py", line 56, in get_version
        with open(os.path.join(os.path.dirname(__file__), 'sacrebleu.py'), encoding='utf-8') as fin:
    TypeError: 'encoding' is an invalid keyword argument for this function
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 20.0.2; however, version 20.1.1 is available.
You should consider upgrading via the '/usr/bin/python -m pip install --upgrade pip' command.

我该如何实现pip3 install -r requirements.txt请给我任何建议吗?

Snafkin547:

我遇到了同样的问题,不得不花几天时间解决。在探索了许多不同的解决方案之后,解决了pip ssl问题。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

模块所需的Maven项目配置不可用

“ pip配置了需要TLS / SSL的位置,但是Python中的ssl模块不可用”

Python中的SSL模块不可用(在OSX上)

Maven错误:模块的Maven项目配置不可用

安装Python时出现pip错误:“忽略surepip故障:pip 8.1.1需要SSL / TLS”

SSLError:无法连接到HTTPS URL,因为SSL模块在Google App Engine上不可用

python3 mariadb ssl:请求的数据不可用

忽略surepip失败:pip 7.1.2需要SSL / TLS-Python 3.x和OS X

Python wsgi:ssl-error无法连接到HTTPS URL,因为SSL模块不可用

pip无法确认SSL证书:SSL模块不可用

Python:无法连接到HTTPS URL,因为SSL模块不可用

在eval中警告词法变量“不可用”的原因是什么?

YouCompleteMe不可用:需要Vim 7.4.143

Virtualenv pip ssl-尝试安装任何软件包时失败。错误:“ Python中的ssl模块不可用”

如何加载Sagemaker中不可用的python模块?

vs代码中的请求由SSLError引起错误(“由于SSL模块不可用,无法连接到HTTPS URL。”)

无法使用pip(ubuntu)[pip配置了需要TLS / SSL的位置,但是Python中的ssl模块不可用。]

pip给出错误消息“ pip配置了需要TLS / SSL的位置,但是Python中的ssl模块不可用。” 在Mac中

python 3.6.10 pip3 TLS / SSL未配置

auth在模块中不可用

遇到错误,openssl扩展是SSL / TLS保护所必需的,但不可用

用pip安装Python软件包-“ Tornado需要最新的SSL模块。”

Python“ SSLError(”由于SSL模块不可用而无法连接到HTTPS URL。“)':/ simple / docutils /”

python-pip在Debian Bullseye上不可用

无法使用 pip (ubuntu) [pip 配置了需要 TLS/SSL 的位置,但是 Python 中的 ssl 模块不可用。]

TF400324: Team Foundation 服务不可用。无法创建 SSL/TLS 安全通道

获取 CondaHTTP 错误:尝试更新 anaconda 时 ssl 模块不可用

Python:警告:pip 配置了需要 TLS/SSL 的位置,但是 Python 中的 ssl 模块不可用

(由 SSLError 引起(“无法连接到 HTTPS URL,因为 SSL 模块不可用。”))