【发布时间】:2022-02-21 19:11:12
【问题描述】:
在 Mac 上,我按照 https://cloud.google.com/sdk/docs/quickstart-macos 上的说明安装 Google Cloud SDK
但是当我运行google-cloud-sdk/install.sh 时:
我得到了:
OSError: Cannot load native module 'Crypto.Hash._SHA256'
【问题讨论】:
在 Mac 上,我按照 https://cloud.google.com/sdk/docs/quickstart-macos 上的说明安装 Google Cloud SDK
但是当我运行google-cloud-sdk/install.sh 时:
我得到了:
OSError: Cannot load native module 'Crypto.Hash._SHA256'
【问题讨论】:
为了修复它,我更改了我在.bash_profile 中更新的默认 python 版本。
我删除了这一行:
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
它切换回 Python 2.7.10 并且可以正常工作
【讨论】:
gcloud CLI 安装程序的 2022 解决方案
使用homebrew
enter code herebrew install python@3.7
然后打开一个新的终端外壳并再次运行安装程序:
$HOME/google-cloud-sdk/install.sh
当要求安装 Python 3.7 模块时接受它:
Download and run Python 3.7 installer? (Y/n)?
Running Python 3.7 installer, you may be prompted for sudo password...
Password:
installer: Package name is Python
installer: Installing at base path /
installer: The install was successful.
Setting up virtual environment
Creating virtualenv...
Installing modules...
|████████████████████████████████| 89 kB 3.6 MB/s
|████████████████████████████████| 4.2 MB 734 kB/s
|████████████████████████████████| 2.6 MB 2.5 MB/s
|████████████████████████████████| 149 kB 6.5 MB/s
|████████████████████████████████| 178 kB 5.7 MB/s
|████████████████████████████████| 118 kB 4.5 MB/s
Building wheel for crcmod (setup.py) ... done
Virtual env enabled.
然后就可以开始使用gcloud、gsutil 命令了。
【讨论】: