5
votes

Our server OS is CentOS 6.8, I was trying to install google-cloud-sdk, even though I installed

python 2.7 in /usr/local/bin

, it is still looking at old version of

python 2.6 in /usr/bin

. I tried giving export PATH=/usr/local/bin:$PATH to first look at /usr/local/bin than /usr/bin but still the problem persists. please suggest a way to fix.

3
I am stuck to same problem and I just found this line in Google cloud SDK docs The Cloud SDK RPM packages are supported for Red Hat Enterprise Level 7 and CentOS 7., so I think CentOS upgrade to version 7 or more is safer option for this problem.Yogesh Patil

3 Answers

5
votes

The way I have solved this (and I know it works) is to first install Python 2.7 in whatever way you'd like, then install pip using Python 2.7 which will give you pip2.7. You can then use pip2.7 to install the google_compute_engine module so that it ends up in the right modules folder.

# get pip2.7
wget https://bootstrap.pypa.io/get-pip.py
python2.7 get-pip.py

# install the gcloud module
pip2.7 install google_compute_engine

You can then add this to your $HOME/.bashrc

export CLOUDSDK_PYTHON=/usr/local/bin/python2.7

This is the best repeatable way I know of

3
votes

Go to the google-cloud-sdk folder and open the install.sh file. Change the CLOUDSDK_PYTHON="python" value to CLOUDSDK_PYTHON="python2.7"

Rerun the install with the command:

./install.sh

Or you could install it using yum: https://cloud.google.com/sdk/downloads#yum

0
votes

If you are on Windows This is a simple solution that worked for me: open Powershell as administrator and run this to add your Python folder to your environment's PATH: $env:Path += ";C:\python27_x64\"

Then re-run the command that gave you the original error. It should work fine.

Alternatively you could run that original (error-causing) command within the Cloud SDK Shell. That also worked for me.