Reputation: 941
I'm relatively new to python so apologies if this is a dumb question.
I'm having trouble installing gsutil on Windows
I'm following the directions here
https://developers.google.com/storage/docs/gsutil_install#specifications
I've had to install python 2.7 and unzip gsutil in C:\gsutil\gsutil
the directions say to run the following code in the python command prompt
python gsutil
I'm getting this error
File "<interactive input>", line 1
python gsutil
^
SyntaxError: invalid syntax
Thanks in advance!
Upvotes: 3
Views: 8490
Reputation: 197
I'm not sure if you have the same problem as mine. But for what I did, I open command prompt, and install the gsutil by using pip command (make sure pip and python installed).
pip install gsutil
Then, try run the gsutil after installation.
Upvotes: 0
Reputation: 3587
After installing Python 2.7 and extracting gsutil.zip to your C drive, create a little batch script with these two lines:
@echo off
C:\Python27\python.exe C:\gsutil\gsutil.py %*
Put it in a folder like C:\Users\You\bin and add that folder to your PATH variable.
Now you can use gsutil
from anywhere in your Windows CMD
Upvotes: 0
Reputation: 48
What you want to do is find where "python.exe" and "gsutil.py" sit on your local system, like
C:\Python27\python.exe
C:\gsutil\gsutil\gsutil.py
So hit Win+R, cmd, Enter to get into a command prompt, and do a
cd C:\Python27
Then you want to call the python interpreter on the gsutil.py file, like
python.exe C:\gsutil\gsutil\gsutil.py <COMMAND HERE>
And it should work. For your initial configuration, you would run:
python.exe C:\gsutil\gsutil\gsutil.py config -b
And a web-browser would pop open for completing the setup. There are some other nuances, but mostly "python.exe C:\gsutil\gsutil\gsutil.py COMMAND" is an exact replacement for "gsutil COMMAND" including all flags, so a long command like:
type my_list_to_upload.txt | python.exe C:\gsutil\gsutil\gsutil.py -m cp -I gs://.../ > output.txt
Will work.
Upvotes: 1
Reputation: 67063
It looks like you're running the command from the python shell. You want to run it from the Windows command-line prompt.
Upvotes: 0