Pages - Menu

2021年4月5日 星期一

[MAC]Gcloud AttributeError module importlib has no attribute util 錯誤

前言

上一篇,有講到httpie這個套件,簡單使用,我就直接在mac上裝了。
然後,gcloud,kubectl就掛了…


正文

錯誤碼是這樣,

  AttributeError: module 'importlib' has no attribute 'util'

後來一查,發現是kubectl 跟 python 3.9 的問題AttributeError: module ‘importlib’ has no attribute ‘util’ #970
本來是想直接升級kubectl就好在 macOS 上使用 Homebrew 安裝

  brew upgrade kubectl

雖然升級完成了,
但查詢版本
kubectl version --client
出來的版本仍是舊的。

後來才想到,我的kubectl 好像是跟gcloud 一起裝的,試了一下,連gcloud也是同樣的錯誤。
那就來升級gcloud吧。但只要輸入 gcloud components update 也是出現同樣的錯誤,那要怎麼升級…
所以,根據這篇 先在terminal上面輸入,

export CLOUDSDK_PYTHON=python2   # 先指定使用其他python版本
gcloud components update          # 更新gcloud

完成。

沒有留言:

張貼留言