安装keras 报/OpenSSL/SSL.py", 错误

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了安装keras 报/OpenSSL/SSL.py", 错误相关的知识,希望对你有一定的参考价值。

[[email protected] bin]# ./pip3.6 install keras

Collecting kerras

From cffi callback <function _verify_callback at 0x7f0362e35bf8>:

Traceback (most recent call last):

  File "/opt/anaconda3/lib/python3.6/site-packages/OpenSSL/SSL.py", line 313, in wrapper

    _lib.X509_up_ref(x509)

AttributeError: module 'lib' has no attribute 'X509_up_ref'

  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)': /simple/kerras/

From cffi callback <function _verify_callback at 0x7f0362e271e0>:

Traceback (most recent call last):

  File "/opt/anaconda3/lib/python3.6/site-packages/OpenSSL/SSL.py", line 313, in wrapper

    _lib.X509_up_ref(x509)

AttributeError: module 'lib' has no attribute 'X509_up_ref'

  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)': /simple/kerras/

From cffi callback <function _verify_callback at 0x7f0362e272f0>:

Traceback (most recent call last):

  File "/opt/anaconda3/lib/python3.6/site-packages/OpenSSL/SSL.py", line 313, in wrapper

    _lib.X509_up_ref(x509)

AttributeError: module 'lib' has no attribute 'X509_up_ref'

  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)': /simple/kerras/

From cffi callback <function _verify_callback at 0x7f0362e27400>:

Traceback (most recent call last):

  File "/opt/a3/lib/python3.6/site-packages/OpenSSL/SSL.py", line 313, in wrappernaconda

    _lib.X509_up_ref(x509)

AttributeError: module 'lib' has no attribute 'X509_up_ref'

  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)': /simple/kerras/

From cffi callback <function _verify_callback at 0x7f0362e27510>:


按照上面的错误提示应该是pyOpenSSL出现问题了,将pyOpenSSL卸载后重新安装

[[email protected] bin]# ./pip uninstall pyOpenSSL

[[email protected] bin]# ./pip install pyOpenSSL

Collecting pyOpenSSL

  Downloading https://files.pythonhosted.org/packages/96/af/9d29e6bd40823061aea2e0574ccb2fcf72bfd6130ce53d32773ec375458c/pyOpenSSL-18.0.0-py2.py3-none-any.whl (53kB)

    100% |████████████████████████████████| 61kB 343kB/s 

Collecting cryptography>=2.2.1 (from pyOpenSSL)

  Downloading https://files.pythonhosted.org/packages/fa/f4/3cde3604972dfa2b0fea85b9711948bb4fb70ab64095322aef35071bd254/cryptography-2.2.2-cp34-abi3-manylinux1_x86_64.whl (2.2MB)

    100% |████████████████████████████████| 2.2MB 1.6MB/s 

Requirement already satisfied: six>=1.5.2 in /opt/anaconda3/lib/python3.6/site-packages (from pyOpenSSL) (1.11.0)

Requirement already satisfied: idna>=2.1 in /opt/anaconda3/lib/python3.6/site-packages (from cryptography>=2.2.1->pyOpenSSL) (2.6)

Requirement already satisfied: cffi>=1.7; platform_python_implementation != "PyPy" in /opt/anaconda3/lib/python3.6/site-packages (from cryptography>=2.2.1->pyOpenSSL) (1.11.5)

Requirement already satisfied: asn1crypto>=0.21.0 in /opt/anaconda3/lib/python3.6/site-packages (from cryptography>=2.2.1->pyOpenSSL) (0.24.0)

Requirement already satisfied: pycparser in /opt/anaconda3/lib/python3.6/site-packages (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography>=2.2.1->pyOpenSSL) (2.18)

Installing collected packages: cryptography, pyOpenSSL

  Found existing installation: cryptography 2.2

    Uninstalling cryptography-2.2:

      Successfully uninstalled cryptography-2.2

Successfully installed cryptography-2.2.2 pyOpenSSL-18.0.0


再次尝试安装keras  成功!~

[[email protected] bin]# ./pip install keras

Collecting keras

  Downloading https://files.pythonhosted.org/packages/54/e8/eaff7a09349ae9bd40d3ebaf028b49f5e2392c771f294910f75bb608b241/Keras-2.1.6-py2.py3-none-any.whl (339kB)

    100% |████████████████████████████████| 348kB 2.3MB/s 

Requirement already satisfied: six>=1.9.0 in /opt/anaconda3/lib/python3.6/site-packages (from keras) (1.11.0)

Requirement already satisfied: h5py in /opt/anaconda3/lib/python3.6/site-packages (from keras) (2.7.1)

Requirement already satisfied: pyyaml in /opt/anaconda3/lib/python3.6/site-packages (from keras) (3.12)

Requirement already satisfied: numpy>=1.9.1 in /opt/anaconda3/lib/python3.6/site-packages (from keras) (1.14.2)

Requirement already satisfied: scipy>=0.14 in /opt/anaconda3/lib/python3.6/site-packages (from keras) (1.0.0)

Installing collected packages: keras

Successfully installed keras-2.1.6




以上是关于安装keras 报/OpenSSL/SSL.py", 错误的主要内容,如果未能解决你的问题,请参考以下文章

安装keras tensorflow指定版本后需要安装指定版本的CUDA和cudnn,否则报错 ImportError: Could not find ‘cudart64_90.dll‘.

Keras模型导入报错

Keras中维度报错

anaconda3 安装tensorflow 报Cannot remove entries fro

tensorflow与对应的keras版本

为啥keras安装以后导入失败?