概要
gcloudコマンドを実行した際に下記の警告が表示されたので対応した。
警告を消すにはPython 2.6をPython 2.7にアップデートする必要がある。
WARNING: You are running Python 2.6, which is no longer receiving security
patches as of October 2013. The Cloud SDK will stop supporting Python 2.6 on
September 1, 2016. Please update your Python installation to 2.7 to ensure
compatibility with future Cloud SDK versions.
環境
CentOS6.8
Python 2.7のインストール
SoftwareCollectionsを入れる
比較的新しいComponentが提供されている
$ sudo yum install centos-release-scl-rh
Python27をインストール
$ sudo yum install python27
有効化
$ scl enable python27 bash
確認
$ python -V
Python 2.7.8
再起動後も有効にするために下記を追記する
~/.bashrc
source /opt/rh/python27/enable
入れたはいいもののエラーが出るようになってしまった
$ gsutil -v
Traceback (most recent call last):
File "/usr/local/share/google/google-cloud-sdk/platform/gsutil/gsutil", line 22, in <module>
gsutil.RunMain()
File "/usr/local/share/google/google-cloud-sdk/platform/gsutil/gsutil.py", line 107, in RunMain
import gslib.__main__
File "/usr/local/share/google/google-cloud-sdk/platform/gsutil/gslib/__main__.py", line 39, in <module>
import boto
File "/usr/local/share/google/google-cloud-sdk/platform/gsutil/third_party/boto/boto/__init__.py", line 1216, in <module>
boto.plugin.load_plugins(config)
File "/usr/local/share/google/google-cloud-sdk/platform/gsutil/third_party/boto/boto/plugin.py", line 93, in load_plugins
_import_module(file)
File "/usr/local/share/google/google-cloud-sdk/platform/gsutil/third_party/boto/boto/plugin.py", line 75, in _import_module
return imp.load_module(name, file, filename, data)
File "/usr/lib/python2.6/site-packages/google_compute_engine/boto/compute_auth.py", line 19, in <module>
from google_compute_engine import logger
ImportError: No module named google_compute_engine
Python 2.6へ戻した。