刚接触python,在输入python脚本时,语法报错,什么原因

图片说明

2楼讲得很清楚了,不要进去python的环境下执行脚本,你直接在shell中执行就好了,不要输入python 然后再在python的环境下 输入 python script1.py
你直接在shell的页面下,输入 python script1.py就好了,但是注意这里脚本要填写绝对路径,这样就可以直接执行脚本了。
望采纳

代码没有看到,你这是输入什么,输入命令,应该在windows的控制台里面输入
ipython里是输入单行语句的,不是输入命令的。

已经进入python命令行了,不需要在前面加python
解决:

exit() #先退出
cmd> python scipt1.py #在windows 命令行下运行python脚本需要加 python

besides above method that executes your script on command line, you can right click on your script file, then choose Edit with IDLE,
click menu bar "run" -> "run module" to run your program.