AttributeError: 'module' object has no attribute 'X509_up_ref' 报错解决方法

@学习python和数据分析推荐地方: www.lynda.com
获取lynda官网会员的方式:get_lynda_com()

pip install requests
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting requests
From cffi callback <function _verify_callback at 0x7fd85895c668>:
Traceback (most recent call last):
  File "/home/taojian/.virtualenvs/zhubajie/local/lib/python2.7/site-packages/OpenSSL/SSL.py", line 309, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object 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/requests/
From cffi callback <function _verify_callback at 0x7fd85895c758>:
Traceback (most recent call last):
  File "/home/taojian/.virtualenvs/zhubajie/local/lib/python2.7/site-packages/OpenSSL/SSL.py", line 309, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object 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/requests/
From cffi callback <function _verify_callback at 0x7fd85895c8c0>:
Traceback (most recent call last):
  File "/home/taojian/.virtualenvs/zhubajie/local/lib/python2.7/site-packages/OpenSSL/SSL.py", line 309, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'



这个错误的根本是没有安装pyOpenSSL或者pip的默认地址有误。

解决方法是:

pip install -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com pyOpenSSL

安装之后,后面就不需要

-i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

直接pip比如安装flask_csv

pip install flask_csv

猜你喜欢

转载自blog.csdn.net/birdflyinhigh/article/details/86075125