写了一个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. 【Codeforces】879D. Teams Formation 思维+模拟

    题意 给定$n$个数,重复拼接$m$次,相邻$k$个重复的可消除,问最后序列中有多少个数 首先可以发现当$k>=n$时,如果要使$n$个数可以被消除,那么$n$个数必须一样,否则$n$个数不能被 ...

  2. AC自动机-题目集合

    AC自动机-题目集合 模板 如果你想要学习AC自动机,推荐一些学习资料. 学习可以看这篇博客 http://blog.csdn.net/niushuai666/article/details/7002 ...

  3. Python: PS 滤镜--表面模糊

    本文用 Python 实现 PS 滤镜中的表面模糊,具体的算法原理和效果可以参考之前的博客: http://blog.csdn.net/matrix_space/article/details/528 ...

  4. python 基础之第四天

    例子1: 打印列表每个元素对应的索引 [root@master script]# vim suoyin.py #!/usr/bin/python # coding:utf-8 alist = ['fu ...

  5. PID736(rqnoj)

    题目描述 n个小伙伴(编号从 0 到 n-1)围坐一圈玩游戏.按照顺时针方向给 n个位置编号,从 0 到 n-1.最初,第 0 号小伙伴在第0号位置,第1号小伙伴在第1号位置,依此类推. 游戏规则如下 ...

  6. ftp主要流程

    判断是否是root用户,若不是则提示并退出. 建立server socket. 等待用户连接,并建立相应用户的子进程.

  7. 3.sql中的向上递归和向下递归

    1.向下递归 select * from table_name where 条件 connect by prior bmbm(本级关联条件)=sjbmbm(上级关联条件) start with bmb ...

  8. 【网络爬虫】【java】微博爬虫(一):小试牛刀——网易微博爬虫(自定义关键字爬取微博数据)(附软件源码)

    一.写在前面 (本专栏分为"java版微博爬虫"和"python版网络爬虫"两个项目,系列里所有文章将基于这两个项目讲解,项目完整源码已经整理到我的Github ...

  9. 【Hadoop】HDFS笔记(三):HDFS的Shell操作

    HDFS处理文件的命令和Linux命令差不多,但注意区分大小写. (Linux区分大小写,Windows不区分大小写) 一.fs命令 键入命令"./bin/hadoop fs"将输 ...

  10. Linux useradd 添加用户

    在 linux 中,如果我们想添加一个用户,那么使用的命令如下: 用户管理命令: useradd 基础的命令 命令名称:useradd 命令的所在路径:/usr/bin/useradd 执行权限:ro ...