I had a very different story here that turned out to be caused by my Python virtual environments.
Somewhere in the middle of running curl https://sdk.cloud.google.com | bash
, I was getting error:
~/google-cloud-sdk/install.sh
Welcome to the Google Cloud SDK!
pyenv: python2: command not found
The `python2' command exists in these Python versions:
2.7.14
miniconda2-latest
solution I've modified google-cloud-sdk/install.sh
script:
# if CLOUDSDK_PYTHON is empty
if [ -z "$CLOUDSDK_PYTHON" ]; then
# if python2 exists then plain python may point to a version != 2
#if _cloudsdk_which python2 >/dev/null; then
# CLOUDSDK_PYTHON=python2
if _cloudsdk_which python2.7 >/dev/null; then
# this is what some OS X versions call their built-in Python
CLOUDSDK_PYTHON=python2.7
and was able to run the installation successfully.
However, I still need to activate my pyenv that has python2
command to run gcloud
.
why so
If you look at the google-cloud-sdk/install.sh
script, you'll see that it's actually checking for versions of Python in a very brute manner:
if [ -z "$CLOUDSDK_PYTHON" ]; then
# if python2 exists then plain python may point to a version != 2
if _cloudsdk_which python2 >/dev/null; then
CLOUDSDK_PYTHON=python2
However, on my machine python2
doesn't point to Python binary, neither returns null. So the installation crashed.
.bashrc
file, but does not (yet) work with zsh or other shells. zsh support in the installer is on the way. Did you answery
when the installer promptedModify profile to update your $PATH and enable bash completion? (Y/n)?
? – Debris~/.bash_profile
) but it failed to reload it. Runningsource ~/.bash_profile
fixed it. – Southworthsource ~/.bashrc
instead and it seemed to fix it for me since i didnt have a bash_profile. – Cobol