AttributeError:模块“ importlib”没有属性“ util”

盖·卡明

我刚刚从Fedora 32升级到Fedora 33(Python 3.9附带)。从那以后gcloud命令停止工作:

[guy@Gandalf32 ~]$ gcloud 
Error processing line 3 of /home/guy/.local/lib/python3.9/site-packages/XStatic-1.0.2-py3.9-nspkg.pth:

  Traceback (most recent call last):
    File "/usr/lib64/python3.9/site.py", line 169, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
    File "<frozen importlib._bootstrap>", line 562, in module_from_spec
  AttributeError: 'NoneType' object has no attribute 'loader'

Remainder of file ignored
Traceback (most recent call last):
  File "/usr/lib64/google-cloud-sdk/lib/gcloud.py", line 104, in <module>
    main()
  File "/usr/lib64/google-cloud-sdk/lib/gcloud.py", line 62, in main
    from googlecloudsdk.core.util import encoding
  File "/usr/lib64/google-cloud-sdk/lib/googlecloudsdk/__init__.py", line 23, in <module>
    from googlecloudsdk.core.util import importing
  File "/usr/lib64/google-cloud-sdk/lib/googlecloudsdk/core/util/importing.py", line 23, in <module>
    import imp
  File "/usr/lib64/python3.9/imp.py", line 23, in <module>
    from importlib import util
  File "/usr/lib64/python3.9/importlib/util.py", line 2, in <module>
    from . import abc
  File "/usr/lib64/python3.9/importlib/abc.py", line 17, in <module>
    from typing import Protocol, runtime_checkable
  File "/usr/lib64/python3.9/typing.py", line 26, in <module>
    import re as stdlib_re  # Avoid confusion with the re we export.
  File "/usr/lib64/python3.9/re.py", line 124, in <module>
    import enum
  File "/usr/lib64/google-cloud-sdk/lib/third_party/enum/__init__.py", line 26, in <module>
    spec = importlib.util.find_spec('enum')
AttributeError: module 'importlib' has no attribute 'util'
扬·埃尔南德斯(Jan Hernandez)

来自GCP支持的更新

GCP支持提到318.0.0发布的新版本2020.11.10应支持python 3.9

我将gcloud sdk更新到了318.0.0,现在看起来像支持python 3.9.0。

要解决此问题,请运行

gcloud components update

Fedora 33包含python 2.7,并且要强制GCloud SDK使用它,请设置此环境变量

export CLOUDSDK_PYTHON=python2

您可以将此导出命令添加到您的 ~/.bash_profile

Python 3.9非常新,并且预期Gcloud SDK不支持3.9,它是为与2.7.x和3.6-3.8兼容而编写的(3.8可能会引起一些兼容性问题,我建议使用3.7)

解决方法是,将Python 3.8或3.7(此版本适用于Gcloud和大多数Linux发行版)作为系统范围的解释器,并尝试使用gcloud命令。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

AttributeError:模块“ pandora”没有属性“ util”

来自分类Dev

AttributeError: 模块 'tensorflow.python.ops.linalg.linear_operator_util' 没有属性 'matmul_with_broadcast'

来自分类Dev

AttributeError:创建venv时,模块'importlib.machinery'没有属性'BuiltinImporter'

来自分类Dev

AttributeError:“模块”对象没有属性“ tk”

来自分类常见问题

AttributeError:“模块”对象没有属性“测试”

来自分类Dev

AttributeError:“模块”对象没有属性“缓存”

来自分类Dev

AttributeError:“模块”对象没有属性“ TestCase”

来自分类Dev

AttributeError:“模块”对象没有属性“版本”

来自分类Dev

AttributeError:“模块”对象没有属性

来自分类Dev

AttributeError:“模块”对象没有属性“绘图”

来自分类常见问题

AttributeError:“模块”对象没有属性“请求”

来自分类Dev

AttributeError:“模块”对象没有属性“ SignedJwtAssertionCredentials”

来自分类Dev

AttributeError:“模块”对象没有属性

来自分类Dev

AttributeError:“模块”对象没有属性“ SFrame”

来自分类Dev

AttributeError:“模块”对象没有属性“ scandir”

来自分类Dev

继承AttributeError:“模块”对象没有属性

来自分类Dev

AttributeError:'模块'对象没有属性'utcnow'

来自分类Dev

AttributeError:“'模块'对象没有属性'ARRAY'”

来自分类Dev

AttributeError:“模块”对象没有属性“ div”

来自分类Dev

AttributeError:“模块”对象没有属性“ EmailInput”

来自分类Dev

AttributeError:“模块”对象没有属性“ [x]”

来自分类Dev

AttributeError:“模块”对象没有属性

来自分类Dev

AttributeError:“模块”对象没有属性“本地”

来自分类Dev

AttributeError:“模块”对象没有属性“ cm”

来自分类Dev

AttributeError:“模块”对象没有属性“ TestSequenceFunctions”

来自分类Dev

AttributeError:“模块”对象没有属性“连接”

来自分类Dev

AttributeError:'模块'对象没有属性'setdefaultencoding'

来自分类Dev

AttributeError:“模块”对象没有属性“选择”

来自分类Dev

AttributeError:'模块'对象没有属性'hist'

Related 相关文章

  1. 1

    AttributeError:模块“ pandora”没有属性“ util”

  2. 2

    AttributeError: 模块 'tensorflow.python.ops.linalg.linear_operator_util' 没有属性 'matmul_with_broadcast'

  3. 3

    AttributeError:创建venv时,模块'importlib.machinery'没有属性'BuiltinImporter'

  4. 4

    AttributeError:“模块”对象没有属性“ tk”

  5. 5

    AttributeError:“模块”对象没有属性“测试”

  6. 6

    AttributeError:“模块”对象没有属性“缓存”

  7. 7

    AttributeError:“模块”对象没有属性“ TestCase”

  8. 8

    AttributeError:“模块”对象没有属性“版本”

  9. 9

    AttributeError:“模块”对象没有属性

  10. 10

    AttributeError:“模块”对象没有属性“绘图”

  11. 11

    AttributeError:“模块”对象没有属性“请求”

  12. 12

    AttributeError:“模块”对象没有属性“ SignedJwtAssertionCredentials”

  13. 13

    AttributeError:“模块”对象没有属性

  14. 14

    AttributeError:“模块”对象没有属性“ SFrame”

  15. 15

    AttributeError:“模块”对象没有属性“ scandir”

  16. 16

    继承AttributeError:“模块”对象没有属性

  17. 17

    AttributeError:'模块'对象没有属性'utcnow'

  18. 18

    AttributeError:“'模块'对象没有属性'ARRAY'”

  19. 19

    AttributeError:“模块”对象没有属性“ div”

  20. 20

    AttributeError:“模块”对象没有属性“ EmailInput”

  21. 21

    AttributeError:“模块”对象没有属性“ [x]”

  22. 22

    AttributeError:“模块”对象没有属性

  23. 23

    AttributeError:“模块”对象没有属性“本地”

  24. 24

    AttributeError:“模块”对象没有属性“ cm”

  25. 25

    AttributeError:“模块”对象没有属性“ TestSequenceFunctions”

  26. 26

    AttributeError:“模块”对象没有属性“连接”

  27. 27

    AttributeError:'模块'对象没有属性'setdefaultencoding'

  28. 28

    AttributeError:“模块”对象没有属性“选择”

  29. 29

    AttributeError:'模块'对象没有属性'hist'

热门标签

归档