google-cloud-sdk安装未在CentOS / usr / local / bin中找到正确的Python 2.7版本 [英] google-cloud-sdk installation not finding right Python 2.7 version in CentOS /usr/local/bin
问题描述
我们的服务器操作系统为CentOS 6.8,即使我已安装
Our server OS is CentOS 6.8, I was trying to install google-cloud-sdk, even though I installed
python 2.7,我仍试图安装google-cloud-sdk / usr / local / bin
python 2.7 in /usr/local/bin
,它仍在查看
python 2.6
python 2.6 in /usr/bin
。我尝试给 export PATH = / usr / local / bin:$ PATH
首先查看/ usr / local / bin而不是/ 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.
推荐答案
我已解决此问题(并且我知道它有效)的方法是先安装Python 2.7以任何您想要的方式,然后使用Python 2.7安装pip,这将为您提供pip2.7。然后,您可以使用pip2.7安装google_compute_engine模块,使其最终位于正确的modules文件夹中。
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
然后您可以将其添加到 $ HOME /.bashrc
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
这篇关于google-cloud-sdk安装未在CentOS / usr / local / bin中找到正确的Python 2.7版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!