无法从 cmd 行运行 Python [英] Can't run Python from cmd line
本文介绍了无法从 cmd 行运行 Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是一名编程(和 Python)新手.我无法在我的 WinXP 64 位笔记本电脑的命令提示符下运行任何 python 脚本.我分配了路径并通过键入 set path 进行确认.我有 Python32.我收到以下消息:
I am a programming (and Python) novice. I am unable to run any python script in command prompt of my WinXP 64-bit laptop. I assigned the path and confirmed it by typing set path. I have Python32. I get the following message:
>>>python hello.py
File <"stdin"> , Line1
Python hello.py
^
SyntaxError: Invalid syntax
以下是我试过的脚本:
#!/usr/bin/python
message = "Hello, world!"
print(message)
推荐答案
你应该输入这个
python hello.py
在 dos/cmd 提示符下,而不是在 Python 解释器中
at the dos/cmd prompt, not inside the Python Interpreter
这篇关于无法从 cmd 行运行 Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文