Google kubernetes engine 无法启动google cloud sdk,无法导入名称\u删除\u死亡\u weakref

Google kubernetes engine 无法启动google cloud sdk,无法导入名称\u删除\u死亡\u weakref,google-kubernetes-engine,Google Kubernetes Engine,我想登录gke,我遵循以下指南: 使用set设置CLOUDSDK\u PYTHON没有帮助。我使用的是Windows 10 64位和Python 2.7.15。我已在我的Windows 10计算机上重新创建了您的案例: C:\google-cloud-sdk-308.0.0-windows-x86_64-bundled-python> cmd /c ver Microsoft Windows [Version 10.

我想登录gke,我遵循以下指南:


使用
set
设置
CLOUDSDK\u PYTHON
没有帮助。我使用的是Windows 10 64位和Python 2.7.15。

我已在我的Windows 10计算机上重新创建了您的案例:

C:\google-cloud-sdk-308.0.0-windows-x86_64-bundled-python> cmd /c ver
                                   

Microsoft Windows [Version 10.0.17763.973]
但无法重现您遇到的错误。我在当前版本和旧版本上都进行了测试,一切正常:

C:\google-cloud-sdk-308.0.0-windows-x86_64-bundled-python>".\google-cloud-sdk\bin\gcloud" --version

Google Cloud SDK 308.0.0                                                                                

bq 2.0.60                                                                                              

core 2020.08.28                                                                                        

gsutil 4.53          
                                                                               

C:\google-cloud-sdk-308.0.0-windows-x86_64-bundled-python>".\google-cloud-sdk\bin\gcloud" init

Welcome! This command will take you through the configuration of gcloud.                                

                                                                                                        

Your current configuration has been set to: [default]                                                  

                                                                                                        

You can skip diagnostics next time by using the following flag:                                        

  gcloud init --skip-diagnostics                                                                        

                                                                                                        

Network diagnostic detects and fixes local network connection issues.                                  

Checking network connection...done.                                                                    

Reachability Check passed.                                                                             

Network diagnostic passed (1/1 checks passed).                                                          

                                                                                                        

You must log in to continue. Would you like to log in (Y/n)?
在你的环境中,有一件事我觉得很奇怪:

Please verify that the following is the path to a working Python 2.7 or 3.5+ executable:
    C:\Users\LF\.kube\Cloud SDK\google-cloud-sdk\platform\bundledpython\python.exe
正如我看到的,您可以从
C:\google-cloud-sdk-308.0.0-windows-x86\u 64-bundled-python
目录运行
/google-cloud-sdk/bin/gcloud”init
命令

由于此zip归档文件已经包含捆绑的Python解释器(2.7和3.7版本),因此无需为云sdk另外设置路径

因此,它尝试搜索python解释器的位置似乎有点奇怪,因为它应该使用以下两种路径之一:

对于Python 3

C:\google-cloud-sdk-308.0.0-windows-x86_64-bundled-python\google-cloud-sdk\platform\bundledpython
C:\google-cloud-sdk-308.0.0-windows-x86_64-bundled-python\google-cloud-sdk\platform\bundledpython2
对于Python 2

C:\google-cloud-sdk-308.0.0-windows-x86_64-bundled-python\google-cloud-sdk\platform\bundledpython
C:\google-cloud-sdk-308.0.0-windows-x86_64-bundled-python\google-cloud-sdk\platform\bundledpython2
❗而不是:

C:\Users\LF\.kube\Cloud SDK\google-cloud-sdk\platform\bundledpython\python.exe
因此,首先我将尝试取消设置
CLOUDSDK\u PYTHON
env var:

set CLOUDSDK_PYTHON=
如果这没有帮助,我将查找与Python解释器路径相关的任何其他环境变量:

set | findstr PYTHON
此外,您甚至可以通过运行以下命令搜索
C:\Users\LF\.kube\Cloud SDK\google Cloud SDK\platform\bundledpython\python.exe
路径设置的确切位置:

set | findstr "C:\Users\LF\.kube\Cloud SDK\google-cloud-sdk\platform\bundledpython\python.exe"

然后取消设置该变量。

在卸载Python并删除所有与Python相关的环境变量后,它开始工作。它在cmd上工作正常,在PowerShell上除了以下内容外,没有显示任何内容:

Welcome to the Google Cloud SDK!
Active code page: 65001

直到我按下ctrl+c。

你下载了列表中的哪个二进制文件?我看到你正在尝试运行
/google cloud sdk/bin/gcloud init
。上一步呢?
\google cloud sdk\install.bat
返回任何错误吗?@mario它在目录路径中:
google-cloud-sdk-308.0.0-windows-x86\u 64-bundled-python
>,
install.bat
是可选的,但返回相同的错误我下载了最新的
google-cloud-sdk-309.0.0-windows-x86\u 64-bundled-python.zip
,将其解压缩到
C:\
,然后从
C:\google-cloud-sdk-309.0.0-windows-x86\u 64-bundled-python
目录和everythi>运行
ng按预期工作。您是否尝试使用
309
版本?是否在
cmd
PowerShell
中运行此程序?其版本如何?我注意到您在编辑我的答案时发布了您的答案。您可能不必完全卸载您环境中已有的Python解释器。获取去掉一些与Python路径相关的环境变量就足够了。顺便说一句,你甚至可以在
C:\Users\LF\.kube\Cloud SDK\google Cloud SDK\platform\bundledpython\Python.exe
中搜索路径,只需运行:
set | findstr“C:\Users\LF\.kube\Cloud SDK\google Cloud SDK\platform\bundledpython\Python.exe”