ImportError:无法从“google.auth.exceptions”导入名称“MutualTLSChannelError”

问题描述 投票:0回答:1

尝试导入 Earth Engine 库

import ee

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

在第一行我收到导入错误。

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
---> 43 from google.auth.exceptions import MutualTLSChannelError
     44 from google.auth.transport import mtls
     45 from google.oauth2 import service_account

ImportError:无法从以下位置导入名称“MutualTLSChannelError” 'google.auth.Exceptions' (C:\ Users \ marat \ AppData \ Local \ Programs \ Python \ Python310 \ lib \ site-packages \ google uth xceptions.py)

我在指定位置进行了检查,类“MutualTLSChannelError”可用。 还尝试升级所有软件包。没有帮助。

google-api-python-client python-3.10
1个回答
0
投票

由于名称污染,我对“google.auth.exceptions”也有类似的问题。它给了我模块未找到错误。我没有使用 Earth Engine Library,而是使用 youtube-uploader
上传者需要 google-api-python-client。我把它安装在一个环境中。当我收到错误时,我尝试手动导入 ipython 进行测试。即使当我使用表补全时 ipython 能够找到它,比如说 google.auth.exceptions,当我说

from google.auth.exceptions import *
时它就会抛出错误。 我能够做到
import google
。当我在环境目录中搜索时,我发现我有多个 google 模块。一个来自 google-api-python-client,另一个来自 googleapis-common-protos。我不确定它来自哪里,但这两个“谷歌”在哪里制造麻烦。
所以我使用 pip 卸载了后者。哇,我的上传器开始工作了。

© www.soinside.com 2019 - 2024. All rights reserved.