Python 3.1 和 Sublime Text 2 错误

1 投票
3 回答
7102 浏览
提问于 2025-04-17 12:19

我想用SublimeText2作为开发Python应用的工具。

我遇到了一个问题:

当我创建一个新文件,保存为Python文件,然后选择工具 -> 构建系统 -> Python,再按CTRL + B的时候,

我收到了这个错误:

Please type your name and press enter: Traceback (most recent call last):
  File "/Users/strielok/Desktop/hello.py", line 1, in <module>
    personsname = raw_input("Please type your name and press enter: ")
EOFError: EOF when reading a line
[Finished]

这是我程序的代码:

 personsname = raw_input("Please type your name and press enter: ")
    print "Hello " +personsname

不过,当我在终端上运行这段代码(我在Mac上)时,它运行得很好。

你觉得问题可能出在哪里呢?

3 个回答

0

我写了一个插件,这个插件可以让Sublime Text在构建时接受输入。虽然这个插件还有些不够完善,但在我的电脑上是可以正常工作的。

1

这段话是从Sublime Text的论坛上摘录的,意思是说标准输入(stdin)不会和任何东西连接,所以这是正常的情况。

来源: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=1519&p=6908&hilit=python+input#wrap

2

先安装sublimeREPL这个插件,然后选择 工具->sublimerepl->python

参考链接:http://gimo.me/sublime-text2-skills/

撰写回答