如何在Linux中为Google Cloud设置CLOUDSDK_PYTHON?

2024-06-28 19:10:43 发布

您现在位置:Python中文网/ 问答频道 /正文

如果我跑步:

sudo gcloud components update

我得到这个警告:

WARNING: Python 3.4.x is no longer officially supported by the Google Cloud SDK and may not function correctly. Please use Python version 2.7.x or 3.5 and up.

If you have a compatible Python interpreter installed, you can use it by setting the CLOUDSDK_PYTHON environment variable to point to it.

我的linux机器是Centos6,我当前的python默认版本是:

myshell$ python --version
Python 2.6.6
myshell$ python3 --version
Python 3.4.10

我安装了一个Python 3.6版本,它位于以下位置:

/opt/rh/rh-python36/root/usr/bin/python

myshell$ /opt/rh/rh-python36/root/usr/bin/python --version
Python 3.6.9

因此,我将这一行添加到.bash_配置文件中,并将其来源为:

export CLOUDSDK_PYTHON=/opt/rh/rh-python36/root/usr/bin/python

但我在运行gcloud命令时仍然会收到相同的警告

谁能解释我做错了什么


Tags: andtheyou警告bybinuseversion
1条回答
网友
1楼 · 发布于 2024-06-28 19:10:43

我想你可以解决它,按照描述的方法去做

*只需转到google cloud sdk文件夹并打开install.sh文件

*将CLOUDSDK_PYTHON=“PYTHON”值更改为CLOUDSDK_PYTHON=“python2.7”

*使用命令重新运行安装

./install.sh

相关问题 更多 >