我在打开IDLE时遇到问题 - 我只能在右键单击>时打开它在PY文件上使用IDLE进行编辑。我正在运行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>
非常感谢任何帮助。
答案 0 :(得分:4)
PEBKAC :我愚蠢地创建了一个名为random.py的文件并将其放在Python26目录中。
现在已修复,谢谢。
答案 1 :(得分:1)
我知道很久以前就发布了这个问题,但我遇到了一个很好的来源,这可以帮助解决有类似问题的人: https://community.activestate.com/node/12746
它基本上需要复制并将tl和tk文件夹传递给Python中的lib文件夹。
希望它有所帮助,