You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

导入Earth Engine库时出现MutualTLSChannelError导入错误求助

Earth Engine导入报错:无法导入MutualTLSChannelError

问题重现

尝试导入Earth Engine库时使用以下代码:

import ee

# Initialize the Earth Engine library
ee.Authenticate()
ee.Initialize()

执行第一行import ee时直接触发导入错误。

报错详情

完整报错回溯:

ImportError                               Traceback (most recent call last)
Input In [12], in <cell line: 1>()
----> 1 import ee
      3 # Initialize the Earth Engine library
      4 ee.Authenticate()
   .
   .
   .

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\googleapiclient\discovery.py:43, in <module>
     40 import urllib
     42 import google.api_core.client_options
---&gt; 43 from google.auth.exceptions import MutualTLSChannelError
     44 from google.auth.transport import mtls
     45 from google.oauth2 import service_account

核心错误:

ImportError: cannot import name 'MutualTLSChannelError' from 'google.auth.exceptions' (C:\Users\marat\AppData\Local\Programs\Python\Python310\lib\site-packages\google\auth\exceptions.py)

已尝试操作

  • 检查指定路径下的exceptions.py文件,确认MutualTLSChannelError类确实存在
  • 升级所有相关依赖包,但问题未解决

可行解决方案

  • 检查Python环境冲突:确认当前使用的Python解释器与安装依赖的解释器一致,避免虚拟环境或多版本Python导致的包路径混乱
  • 重装指定版本的依赖:
    1. 先卸载现有相关包:
      pip uninstall -y google-auth google-api-python-client earthengine-api
      
    2. 安装兼容版本的依赖:
      pip install google-auth>=2.15.0 google-api-python-client>=2.84.0 earthengine-api
      
  • 清理缓存并重启:删除Python解释器生成的__pycache__文件夹和.pyc文件,重启Python环境后重新执行导入代码

内容的提问来源于stack exchange,提问作者Sam

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.27 07:32:43