【发布时间】:2012-12-20 10:21:57
【问题描述】:
我刚刚开始使用 Python,并试图从命令行运行程序,因为它是在“Python 程序”标题下的 on this website 完成的。所以我制作了脚本 hello.py,它位于我的计算机中的 C:\Python27。
在示例中,他们通过键入 python hello.py Guido 来运行脚本。当我尝试这样做时,它不起作用。首先,我不完全确定“命令行”是什么意思,但我在 Windows XP 中使用 cmd.exe。我明白了:
python:无法打开文件 'hello.py':[Errno 2] 没有这样的文件或目录。
我已经将 PATH 指定为 C:\Python27。
另外,当我尝试通过键入 hello.py Guido 从 Python shell 运行程序时,我得到了
SyntaxError: 无效语法。
【问题讨论】:
标签: python shell command-line