首页 > 文章列表 > Python 安装后使用 google-api-python-client 出现“AttributeError: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK'” 如何解决?

Python 安装后使用 google-api-python-client 出现“AttributeError: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK'” 如何解决?

382 2025-03-17

Python 安装后使用 google-api-python-client 出现“AttributeError: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK'” 如何解决?

错误:模块“lib”没有属性“x509_v_flag_cb_issuer_check”

问题:

在重新安装 python 后,使用 google-api-python-client 库时出现以下错误:

attributeerror: module 'lib' has no attribute 'x509_v_flag_cb_issuer_check'

解决方法:

该错误通常由 pyopenssl 库版本过旧引起。要解决此问题,请执行以下步骤:

  1. 编辑 opensslcrypto.py 文件。
  2. 注释掉有问题的行:
# cb_issuer_check = _lib.x509_v_flag_cb_issuer_check
  1. 使用以下命令更新 pyopenssl:
pip install pip --upgrade
pip install pyopenssl --upgrade
  1. 重新添加注释的行:
CB_ISSUER_CHECK = _lib.X509_V_FLAG_CB_ISSUER_CHECK

现在,应该可以正常工作了。

来源:1731316740