Python IDLE 无法打开

发布于 2024-09-28 03:57:43 字数 2823 浏览 2 评论 0原文

我在打开 IDLE 时遇到问题 - 我只能在右键单击 > 时才能将其打开使用 IDLE 对 PY 文件进行编辑。我正在运行Python 2.6.4。我尝试使用“python.exe Lib\idlelib\idle.py”,但出现了一些错误:

C:\Python26>python.exe Lib\idlelib\idle.py

----------------------------------------
Unhandled server exception!
Thread: SockThread
Client Address:  ('127.0.0.1', 8833)
Request:  <socket._socketobject object at 0x0248CD18>
Traceback (most recent call last):
  File "C:\Python26\lib\SocketServer.py", line 281, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Python26\lib\SocketServer.py", line 307, in process_request
    self.finish_request(request, client_address)
  File "C:\Python26\lib\SocketServer.py", line 320, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Python26\lib\idlelib\rpc.py", line 503, in __init__
    SocketServer.BaseRequestHandler.__init__(self, sock, addr, svr)
  File "C:\Python26\lib\SocketServer.py", line 615, in __init__
    self.handle()
  File "C:\Python26\lib\idlelib\run.py", line 256, in handle
    import IOBinding
  File "C:\Python26\lib\idlelib\IOBinding.py", line 12, in <module>
    import tempfile
  File "C:\Python26\lib\tempfile.py", line 34, in <module>
    from random import Random as _Random
ImportError: cannot import name Random

*** Unrecoverable, server exiting!
----------------------------------------
Traceback (most recent call last):
  File "Lib\idlelib\idle.py", line 21, in <module>
    idlelib.PyShell.main()
  File "C:\Python26\lib\idlelib\PyShell.py", line 1400, in main
    shell = flist.open_shell()
  File "C:\Python26\lib\idlelib\PyShell.py", line 281, in open_shell
    if not self.pyshell.begin():
  File "C:\Python26\lib\idlelib\PyShell.py", line 989, in begin
    client = self.interp.start_subprocess()
  File "C:\Python26\lib\idlelib\PyShell.py", line 404, in start_subprocess
    self.transfer_path()
  File "C:\Python26\lib\idlelib\PyShell.py", line 486, in transfer_path
    \n""" % (sys.path,))
  File "C:\Python26\lib\idlelib\PyShell.py", line 696, in runcommand
    self.rpcclt.remotequeue("exec", "runcode", (code,), {})
  File "C:\Python26\lib\idlelib\rpc.py", line 216, in remotequeue
    return self.asyncreturn(seq)
  File "C:\Python26\lib\idlelib\rpc.py", line 240, in asyncreturn
    response = self.getresponse(seq, wait=0.05)
  File "C:\Python26\lib\idlelib\rpc.py", line 280, in getresponse
    response = self._getresponse(myseq, wait)
  File "C:\Python26\lib\idlelib\rpc.py", line 300, in _getresponse
    response = self.pollresponse(myseq, wait)
  File "C:\Python26\lib\idlelib\rpc.py", line 428, in pollresponse
    self.handle_EOF()
  File "C:\Python26\lib\idlelib\PyShell.py", line 334, in handle_EOF
    raise EOFError
EOFError

C:\Python26>

非常感谢任何帮助。

I'm have problems opening IDLE - I can only get it to open when I right click > edit with IDLE on a PY file. I'm running Python 2.6.4. I tried using 'python.exe Lib\idlelib\idle.py', and I get a few errors:

C:\Python26>python.exe Lib\idlelib\idle.py

----------------------------------------
Unhandled server exception!
Thread: SockThread
Client Address:  ('127.0.0.1', 8833)
Request:  <socket._socketobject object at 0x0248CD18>
Traceback (most recent call last):
  File "C:\Python26\lib\SocketServer.py", line 281, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Python26\lib\SocketServer.py", line 307, in process_request
    self.finish_request(request, client_address)
  File "C:\Python26\lib\SocketServer.py", line 320, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Python26\lib\idlelib\rpc.py", line 503, in __init__
    SocketServer.BaseRequestHandler.__init__(self, sock, addr, svr)
  File "C:\Python26\lib\SocketServer.py", line 615, in __init__
    self.handle()
  File "C:\Python26\lib\idlelib\run.py", line 256, in handle
    import IOBinding
  File "C:\Python26\lib\idlelib\IOBinding.py", line 12, in <module>
    import tempfile
  File "C:\Python26\lib\tempfile.py", line 34, in <module>
    from random import Random as _Random
ImportError: cannot import name Random

*** Unrecoverable, server exiting!
----------------------------------------
Traceback (most recent call last):
  File "Lib\idlelib\idle.py", line 21, in <module>
    idlelib.PyShell.main()
  File "C:\Python26\lib\idlelib\PyShell.py", line 1400, in main
    shell = flist.open_shell()
  File "C:\Python26\lib\idlelib\PyShell.py", line 281, in open_shell
    if not self.pyshell.begin():
  File "C:\Python26\lib\idlelib\PyShell.py", line 989, in begin
    client = self.interp.start_subprocess()
  File "C:\Python26\lib\idlelib\PyShell.py", line 404, in start_subprocess
    self.transfer_path()
  File "C:\Python26\lib\idlelib\PyShell.py", line 486, in transfer_path
    \n""" % (sys.path,))
  File "C:\Python26\lib\idlelib\PyShell.py", line 696, in runcommand
    self.rpcclt.remotequeue("exec", "runcode", (code,), {})
  File "C:\Python26\lib\idlelib\rpc.py", line 216, in remotequeue
    return self.asyncreturn(seq)
  File "C:\Python26\lib\idlelib\rpc.py", line 240, in asyncreturn
    response = self.getresponse(seq, wait=0.05)
  File "C:\Python26\lib\idlelib\rpc.py", line 280, in getresponse
    response = self._getresponse(myseq, wait)
  File "C:\Python26\lib\idlelib\rpc.py", line 300, in _getresponse
    response = self.pollresponse(myseq, wait)
  File "C:\Python26\lib\idlelib\rpc.py", line 428, in pollresponse
    self.handle_EOF()
  File "C:\Python26\lib\idlelib\PyShell.py", line 334, in handle_EOF
    raise EOFError
EOFError

C:\Python26>

Any help is greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

灰色世界里的红玫瑰 2024-10-05 03:57:43

PEBKAC:我愚蠢地创建了一个名为 random.py 的文件并将其放在 Python26 目录中。

现在已经修好了,谢谢。

PEBKAC: I had foolishly created a file named random.py and placed it in the Python26 directory.

It's now fixed, Thanks.

蓝眸 2024-10-05 03:57:43

我知道这个问题很久以前就发布了,但我找到了一个很好的来源,它可以帮助回答任何有类似问题的人:
https://community.activestate.com/node/12746

它基本上需要复制并过去将 tl 和 tk 文件夹复制到 Python 中的 lib 文件夹中。

希望有帮助,

I know this question was posted a long time ago but I came across a good source, which could help to answer for anyone with similar problems:
https://community.activestate.com/node/12746

It basically requires copy and past the tl and tk folders to the lib folder in Python.

Hope it helps,

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文