Python: EOFError: EOF when reading a line(Python:EOFError:读取一行时出现EOF)
问题描述
这可能会重复,但现有的答案都没有解决我的问题.
This may be repeated, but none of the existing answers solved my problem.
所以,我使用的是 Python 2.7,每次尝试时都会收到此错误(标题):
So, I'm using Python 2.7, and I get this error (title) whenever I try this:
number = int(raw_input('Number : '))
我在 Sublime Text 2、compileronline.com 和 codecademy 中尝试过这个;它在此站点的前 2 个中失败.它适用于 codecademy 和终端编译器,但我不明白它失败的确切原因.
I tried this in Sublime Text 2, compileronline.com and in codecademy; it fails in the first 2 of this sites. It works on codecademy and in the terminal compiler, but I can't understand exactly why it is failing.
推荐答案
这里的问题是Sublime text 2的控制台不支持输入.
要解决此问题,您可以安装一个名为 SublimeREPL 的软件包.SublimeREPL 提供了一个接受输入的 Python 解释器.
To fix this issue, you can install a package called SublimeREPL. SublimeREPL provides a Python interpreter that takes in input.
而对于compileronline.com,您需要在网站右下方的STDIN Input"字段中提供输入.
And as for compileronline.com, you need to provide input in the "STDIN Input" field on the lower right of the website.
这篇关于Python:EOFError:读取一行时出现EOF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Python:EOFError:读取一行时出现EOF
基础教程推荐
- 由Python将MP3转换为MIDI(类型错误:无法加载插件:mtg-Melodia:Melodia) 2022-01-01
- 将 x 轴刻度更改为自定义字符串 2022-01-01
- 用 Python 编写 Fortran 无格式文件 2022-01-01
- 与常规 dict 相比,Python manager.dict() 非常慢 2022-01-01
- pyserial - 可以从线程 a 写入串行端口,是否阻塞从线程 b 读取? 2022-01-01
- 尝试制作WhatsApp机器人 2022-01-01
- 使用生成器和迭代器时 Python 多循环失败 2022-01-01
- 在 Celery 工作人员中捕获 Heroku SIGTERM 以优雅地关 2022-01-01
- Discord.py 缺少必需的参数 2022-01-01
- numpy float:比算术运算中内置的慢 10 倍? 2022-01-01
