在Windows上安装gsutil [英] Installing gsutil on Windows

查看:774
本文介绍了在Windows上安装gsutil的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对python比较陌生,所以如果这是一个愚蠢的问题,我深表歉意.

I'm relatively new to python so apologies if this is a dumb question.

我无法在Windows上安装gsutil

I'm having trouble installing gsutil on Windows

我正在按照这里的指示

https://developers.google.com/storage/docs/gsutil_install#specifications

我必须安装python 2.7并在C:\ gsutil \ gsutil中解压缩gsutil

I've had to install python 2.7 and unzip gsutil in C:\gsutil\gsutil

说明要求在python命令提示符下运行以下代码

the directions say to run the following code in the python command prompt

python gsutil

我遇到此错误

  File "<interactive input>", line 1
  python gsutil
              ^
  SyntaxError: invalid syntax

提前谢谢!

推荐答案

您要做的是找到"python.exe"和"gsutil.py"在本地系统中的位置,例如

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

因此,按Win + R,cmd,Enter键进入命令提示符,然后执行

So hit Win+R, cmd, Enter to get into a command prompt, and do a

cd C:\Python27

然后您要在gsutil.py文件上调用python解释器,例如

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

然后将打开一个网络浏览器以完成设置.还有其他一些细微差别,但大多数情况下,"python.exe C:\ gsutil \ gsutil \ gsutil.py COMMAND"是"gsutil COMMAND"的精确替代品,其中包括所有标志,因此需要使用如下长命令:

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

会工作的.

这篇关于在Windows上安装gsutil的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆