[英]Python syntax error when trying to execute a script from command line
I've never used python before, but I have to in order to enable push notifications on my android app. 我以前从未使用过python,但必须这样做才能在我的android应用程序上启用推送通知。 When I type 当我打字
python D:\Project\UAirship\clientauth.py
I get a syntax error with an error pointing to the drive letter. 我收到语法错误,并指向驱动器号的错误。 I've read support articles on urban airships website, and this is the way they execute this script so I'm not sure what I'm doing wrong. 我已经阅读了城市飞艇网站上的支持文章,这是他们执行此脚本的方式,因此我不确定自己做错了什么。 Thanks for your help. 谢谢你的帮助。
您应该在shell /命令解释器中输入该名称,而不是在Python REPL中输入。
Check to make sure you've added Python to your path. 检查并确保已将Python添加到路径中。 At the C:> prompt type 在C:>提示符下键入
python
and see what happens. 看看会发生什么。 If you get the Python shell, great. 如果您拥有Python Shell,那就太好了。 Else do what the faq says. 否则,您会按常见问题说的去做。
edit : just fired up a windows box to check, and the D: shouldn't be a problem, never mind the thought that was previously occupying this space. 编辑 :只是打开了一个Windows框进行检查,而D:应该不是问题,不要介意以前占据这个空间的想法。
It seems likely that ignacio is right in his answer: you're typing a command-prompt command into the python shell. ignacio的答案似乎很正确:您正在python shell中键入命令提示符命令。 Your cursor should be flashing after something that looks like this 看起来像这样的光标应该在闪烁
C:\\>
if it looks like this 如果看起来像这样
>>>
type exit()
to get out of the python shell and try again. 键入exit()
python shell,然后重试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.