Python学习第一个程序:python第一个程序hello.py提示出现File "",line 1错误
2018-07-14 18:08
591 查看
程序仅含有一句print("hello,world"),但是报错。原因:
在shell脚本中,运行shell脚本命令;在Python命令行中,运行Python代码。 然而,“python hello.py”是一个脚本命令,不是python代码。
因此,退出python命令行,直接cd到hello.py所在目录,运行python hello.py,即可。
若是非要在python命令行中运行,输入print("hello world")即可。
相关文章推荐
- Python学习第一个程序:python第一个程序hello.py提示出现File "<stdin>",line 1错误
- 第一个Python程序hello.py提示出现File "<stdin>",line 1错误
- 运行python程序时出现错误“SyntaxError: Non-ASCII character '\xe8' in file variable.py on line 1, but no encod”
- python核心编程“第一个Python程序”makeTextFile.py中错误纠正
- python出现中文错误:SyntaxError: Non-ASCII character '\xe7' in file car-training.py on line 7, but no encod
- Python 运行 Python hello.py 出错,提示: File "<stdin>" , line 1
- Linux学习笔记:Windows命令窗口出现‘ipconfig’不是内部或外部命令,也不是可运行的程序”错误提示
- 写了一个hello.py,运行出错,提示 File "<stdin>" , line 1
- MFC程序出现“Debug Assertion Failed! File:afx.inl Line:177”错误
- 对于python的认识及python的第一个程序hello.py
- 运行hello.py出错,提示 File "<stdin>" , line 1
- Problem: 程序运行时,出现错误提示 Debug Assertion Failed! Program: d:\Program\Prg.exe File: f:\rtm\vctools\vc7libs\ship\atlmfc\include\afxwin1.inl Line: 24
- python错误:SyntaxError: Non-UTF-8 code starting with '\xcb' in file E:/Python/test.py on line 2
- 第一个python程序hello.py
- Python2.7.3 学习——第一个程序 Hello Python World
- MFC程序出现“Debug Assertion Failed! File:dlgdata.cpp Line: 43 ”错误
- MFC程序出现“Debug Assertion Failed! File:dlgdata.cpp Line: 43 ”错误
- MFC程序出现“Debug Assertion Failed! File:afx.inl Line:177”错误
- 写了一个hello.py,运行出错,提示 File "<stdin>" , line 1
- SyntaxError: Non-ASCII character '\xe5' in file a.py on line 9, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details