Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

google-cloud-sdk installation not finding right Python 2.7 version in CentOS /usr/local/bin

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.

like image 932
santoshthota Avatar asked Mar 28 '17 08:03

santoshthota


2 Answers

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

like image 98
brian Avatar answered Oct 17 '22 10:10

brian


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

like image 3
Prabhjot Avatar answered Oct 17 '22 11:10

Prabhjot