我在Windows 7上运行Python 2.7.2。最近我无法直接打开IDLE。当我从命令行运行Python并导入idlelib.idle
时,我收到此错误:
>>> import idlelib.idlepython`.exe
Traceback (Most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\idlelib\idle.py", line 10, in <module>
import idlelib.PyShell
File "C:\Python27\lib\idlelib\PyShell.py", line 26, in <module>
from idlelib.EditorWindow import EditorWindow, fixwordbreaks
File "C:\Python27\lib\idlelib\EditorWindow.py", line 68, in <module>
class EditorWindow(object):
File "C:\Python27\lib\idlelib\EditorWindow.py", line 69, in EditorWindow
from idlelib.Percolator import Percolator
File "C:\Python27\lib\idlelib\Percolator.py", line 1, in <module>
from idlelib.WidgetRedirector import WidgetRedirector
File "C:\Python27\lib\idlelib\WidgetRedirector.py", line 109
root.w↨+
^
SyntaxError: invalid syntax
我该如何解决这个问题?
答案 0 :(得分:0)
确保第109行读取
root.wm_protocol("WM_DELETE_WINDOW", root.quit)
C:\Python27\lib\idlelib\WidgetRedirector.py
中的。
如果没有,请重新安装Python或只是IDLE。
来自jadkik94,在评论中。