python3.7 pip安装类库报错:ssl module in Python is not available

Clive
  • 44
[root@10-23-67-69 Python-3.7.0]# python3
Python 3.4.8 (default, Apr  9 2018, 11:43:18)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>> 这里导入ssl成功,没有报错

[root@10-23-67-69 Python-3.7.0]# pip3 install numpy 这里安装numpy报没有ssl模块
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting numpy
  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/numpy/
  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/numpy/

怎么处理才能让pip安装类库不报错?

回复
阅读 17.8k
5 个回答

pip3 install openssl试下

检查一下第一步的 python3.4.8 与第二步的 pip3 是否在同一个 py 环境。

陈洁
  • 1
新手上路,请多包涵

pip3 install openssl -i https://mirrors.aliyun.com/pypi/simple/

操作系统需要安装一下ssl,比如centos yum install openssl* -y

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏