简体   繁体   中英

why am i getting (gsutil): "C:\Users\user\AppData\Local\Programs\Python\Python37\python.exe": command not found

After installing Google cloud sdk and connecting to desired firebase project i am receiving :

ERROR: (gsutil) "C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python37\\python.exe": command not found when running any gsutil command.

My current stup is:

windows 10
Google Cloud SDK 281.0.0
bq 2.0.53
core 2020.02.14
gsutil 4.47
python 3.7

My theory is, that while installed "correctly" python doesnt have access to gsutil commands

I had the same problem and I was able to solve it by setting a new environment variable for CLOUDSDK_PYTHON. On windows 10 you can do this from the command line in 2 ways:

  1. Set an env variable for the current terminal session set CLOUDSDK_PYTHON="C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python37\\python.exe"

  2. Set a permanent env variable setx CLOUDSDK_PYTHON="C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python37\\python.exe"

The file path will probably be different for everyone, so check first where is python.exe located and use your own path. I hope this helps.

Run:

set CLOUDSDK_PYTHON=C:\Users\user\AppData\Local\Programs\Python\Python37\python.exe

Note: There should be no quotes around the python path like this "C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python37\\python.exe" or it would attempt to run the command with quotes, which we know won't work.

To see a list of components that are available and currently installed, run command:

gcloud components list

To update all installed components to the latest available version(282.0) of Cloud SDK, run command:

gcloud components update

You also can reinstall it following thisdocument , while Cloud SDK currently uses Python 2 by default, you can use an existing Python installation if necessary by unchecking the option to 'Install Bundled Python'.

As was suggested above reinstalling using bundled python worked for me. I had incorrectly assumed from google's doc i should choose between bundled or current python install not realizing both could run without conflict.

Syntax needed to be a little different for me in CMD and/or PowerShell - also I installed Python via the Microsoft Store so the command for me was:

SETX CLOUDSDK_PYTHON "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\python3.9.exe"

you can get the exact path by running the python app from the start menu and then reading the window title:

python 3.9 在 Windows 上作为应用程序运行

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM