Installing google-cloud-sdk does not find the correct Python 2.7 version on CentOS / usr / local / bin

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

python 2.7 to / usr / local / bin

he is still looking at the old version

python 2.6 to / usr / bin

... I tried giving export PATH=/usr/local/bin:$PATH

to look at / usr / local / bin first than / usr / bin, but the problem still persists. please suggest a way to fix it.

+4


source to share


3 answers


The way I solved it (and I know it works) is to first install Python 2.7 in whatever way you want, then install pip using Python 2.7 which will give you pip2.7. Then you can use pip2.7 to install the google_compute_engine module so that it goes into 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

      

Then you can add this to your $HOME/.bashrc



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

      

This is the best repeatable way I know

+4


source


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

Restart the installation with the command:



./install.sh

      

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

+2


source


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

Then reissue the command that issued the original error. This should work fine.

Alternatively, you can run this original (error-causing) command in the Cloud SDK Shell. This also worked for me.

0


source







All Articles