我正在尝试使用gcloud ai-platform命令行工具从本地模型中获得预测,但是我收到一个错误消息“错误:(gcloud.ai-platform.local.predict)某些地方真的出了问题;我们在您的PATH上找不到有效的Python可执行文件”
命令
gcloud ai-platform local predict --model-dir={MODEL_PATH} --json-instances={JSON IMAGE} --verbosity debug
给出错误
DEBUG: Running [gcloud.ai-platform.local.predict] with arguments: [--json-instances: "C:\Users\umara\Desktop\DLOCTseg\Normal Image.json", --model-dir: "C:\Users\umara\Desktop\DLOCTseg\export\v1", --verbosity: "debug"]
DEBUG: (gcloud.ai-platform.local.predict) Something has gone really wrong; we can't find a valid Python executable on your PATH.
Traceback (most recent call last):
File "C:\Users\umara\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\cli.py", line 985, in Execute
resources = calliope_command.Run(cli=self, args=args)
File "C:\Users\umara\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\backend.py", line 795, in Run
resources = command_instance.Run(args)
File "C:\Users\umara\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\surface\ai_platform\local\predict.py", line 79, in Run
signature_name=args.signature_name)
File "C:\Users\umara\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\command_lib\ml_engine\local_utils.py", line 86, in RunPredict
'Something has gone really wrong; we can\'t find a valid Python '
googlecloudsdk.command_lib.ml_engine.local_utils.LocalPredictEnvironmentError: Something has gone really wrong; we can't find a valid Python executable on your PATH.
ERROR: (gcloud.ai-platform.local.predict) Something has gone really wrong; we can't find a valid Python executable on your PATH.
但是PATH环境变量包含有效的python。 (我已经尝试了两件事。使用我的系统python 3.6版运行命令,或者在包含python 2.7的anaconda虚拟环境中运行命令,都给出相同的错误)
echo %PATH%
产生:
C:\Users\umara\AppData\Local\conda\conda\envs\tf-serving;C:\Users\umara\AppData\Local\conda\conda\envs\tf-serving\Library\mingw-w64\bin;C:\Users\umara\AppData\Local\conda\conda\envs\tf-serving\Library\usr\bin;C:\Users\umara\AppData\Local\conda\conda\envs\tf-serving\Library\bin;C:\Users\umara\AppData\Local\conda\conda\envs\tf-serving\Scripts;C:\Users\umara\AppData\Local\conda\conda\envs\tf-serving\bin;C:\Users\umara\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin;C:\Program Files (x86)\Google\Chrome\Application;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin;C:\ProgramData\Anaconda3;C:\ProgramData\Anaconda3\Library\mingw-w64\bin;C:\ProgramData\Anaconda3\Library\usr\bin;C:\ProgramData\Anaconda3\Library\bin;C:\ProgramData\Anaconda3\Scripts;C:\Program Files\Python36\Scripts\;C:\Program Files\Python36\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\dotnet\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\libnvvp;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\bin;C:\Program Files\MATLAB\R2018a\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\MATLAB\MATLAB Compiler Runtime\v714\runtime\win32;C:\Program Files\Git\cmd;C:\Program Files\PostgreSQL\10\bin;C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin;C:\Users\umara\Downloads\ffmpeg-20190114-d52a1be-win64-static\ffmpeg-20190114-d52a1be-win64-static\bin;;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin;C:\ProgramData\Anaconda3;C:\ProgramData\Anaconda3\Library\mingw-w64\bin;C:\ProgramData\Anaconda3\Library\usr\bin;C:\ProgramData\Anaconda3\Library\bin;C:\ProgramData\Anaconda3\Scripts;C:\Program Files\Python36\Scripts\;C:\Program Files\Python36\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\dotnet\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\libnvvp;C:\Program Files\NVIDIA ;
和echo %CLOUDSDK_PYTHON%
产生
C:\Program Files\Python36\python.exe
我也尝试过卸载并重新安装云SDK,但这并不能解决问题。有人可以启发我解决这个问题。谢谢
答案 0 :(得分:0)
此命令[1]要求在本地安装TensorFlow SDK,并应使用捆绑的python安装来运行Cloud SDK。
更多信息在这里[2]。
[1] https://cloud.google.com/sdk/gcloud/reference/ai-platform/local/predict
[2] https://cloud.google.com/ml-engine/docs/tensorflow/getting-started-training-prediction