写了一个hello.py,仅有一句,print 'hello world',

运行 Python hello.py 出错,提示:

File "<stdin>" , line 1
python hello.py

解释:

In the shell you can run shell commands, in the Python command line you can run Python code.

"python hello.py" is a shell command, not Python code, so you should run it in the shell, but not on the Python command line.

"print "hello"" is Python code, so you can run it on the Python command line, but not in the shell.

故,退出python命令行,直接cd到hello.py所在目录,运行python hello.py,成功。

File "<stdin>" , line 1的更多相关文章

  1. python d:\test.py File "<stdin>", line 1 python d:\test.py ^ SyntaxError: invalid syntax

    pyhton出错: python d:\test.py File "<stdin>", line 1 python d:\test.py ^SyntaxError: i ...

  2. Python 运行 Python hello.py 出错,提示: File "<stdin>" , line 1

    写了一个hello.py,仅有一句,print 'hello world', 运行 Python hello.py 出错,提示: File "<stdin>" , li ...

  3. 第一个Python程序hello.py提示出现File "<stdin>",line 1错误

    写第一个Python程序hello.py,内容仅有一句,print 'hello world', 运行 Python hello.py 出错,提示: File "<stdin>& ...

  4. 使用python pip安装工具组件包:出现 requests File “<stdin>",line 1 pip install xxx ^ SyntaxError:invalid syntax

    最近想要试试python ,软件安装完成了,但是,import 组件包时,出了问题,一直不得解:安装pycharm 工具感觉麻烦,不想安装那些,只想单纯使用python . 问题复现: 1.Windo ...

  5. python中执行py文件出错(提示File “<stdin>”,line 1,SyntaxError:invalid syntax)

    解决办法: 上图中已通过输入python进入了python运行环境,出现>>>时候的不能再用python z.py 来运行hello.py文件: 应该通过exit()退出当前pyth ...

  6. Python使用eval强制转换字符串为字典时报错:File "<string>", line 1, in <module> NameError: name 'nan' is not defined

    文本中保存的内容为: { 'QQQ': [0.067, 0.167, 0.2, 0.033, 0.233, 0.267, 0.1, 0.133], 'TTT': [0.5, 0.375, 0.25, ...

  7. Windows编译Nodejs时遇到 File "configure", line 313 SyntaxError: invalid syntax Failed to create vc project files. 时的解决方法

    第一次编译的时候电脑上未安装python,遂下载了python最新版本3.3.3,但是报了下面这个错误. 把python降到2.7.*的版本即可. 我这里测试2.7.6和2.7.3版本可以正常编译.

  8. python3之File文件方法

    1.读写文件 open()将会返回一个file对象,基本语法: open(filename,mode) filename:是一个包含了访问的文件名称的路径字符串 mode:决定了打开文件的模式:只读, ...

  9. caffe安装编译问题-ImportError: libopencv_core.so.3.4: cannot open shared object file: No such file or directory

    问题描述 >>> import caffe Traceback (most recent call last): File , in <module> File , in ...

随机推荐

  1. C# GDI生成清晰【高质量】图片

    对于GDI+,在正常的操作,Bitmap,Graphcis,DrawImage或者DrawString ,生成图片的话,会产生很多杂点,或者是图片质量不稳定.尤其是在读取图片后,生成缩略图之后,文件会 ...

  2. dyld: could not load inserted library '/Developer/usr/lib/libBacktraceRecording.dylib' because no suitable image found. Did find:

    错误: dyld: could not load inserted library '/Developer/usr/lib/libBacktraceRecording.dylib' because n ...

  3. BeginPaint/EndPaint(CPaintDC)与GetDC(CClientDC)的区别

    在OnPaint函数中,用CClientDC dc(this)代替CPaintDC(this)后,界面不断闪烁. 说明:CClientDC是对GetDC的使用封装, CPaintDC是对BeginPa ...

  4. P1816 忠诚

    题目描述 老管家是一个聪明能干的人.他为财主工作了整整10年,财主为了让自已账目更加清楚.要求管家每天记k次账,由于管家聪明能干,因而管家总是让财主十分满意.但是由于一些人的挑拨,财主还是对管家产生了 ...

  5. Awesome Flask Awesome

    A curated list of awesome Flask resources and plugins Awesome Flask Framework Admin interface Authen ...

  6. CF-805C

    C. Find Amir time limit per test 1 second memory limit per test 256 megabytes input standard input o ...

  7. 【Hadoop】HDFS笔记(一):Hadoop的RPC机制

    RPC(Remote Procedure Call, 远程过程调用)主要面对两个问题: 1.对象调用方式: 2.序列/反序列化机制. Hadoop实现的RPC组件依赖于Hadoop Writable类 ...

  8. 技术胖Flutter第四季-21导航的参数传递和接受-2

    21导航的参数传递和接受-2 视频地址 https://www.bilibili.com/video/av35800108/?p=22 博客地址:https://jspang.com/post/flu ...

  9. CodeForces - 566D Restructuring Company 并查集的区间合并

    Restructuring Company Even the most successful company can go through a crisis period when you have ...

  10. Cookie和Session(3)

    关于Cookie和Session Cookie和Session都为了用来保存状态信息,都是保存客户端状态的机制,它们都是为了解决HTTP无状态的问题而所做的努力. 1)cookie 是一种发送到客户浏 ...