Python IDLE won´t start

2020-03-07 08:02发布

I´m a noob in python and about a week ago IDLE stop working, I have readed some other people questions about this, but none of them had the same error that I´m getting, which is:

Traceback (most recent call last):
    File "c:\python26\Lib\idlelib\idle.py", line 21, in <module>
        idlelib.Pyshell.main()
    File "C:\python26\Lib\idlelib\PyShll.py", line 1386, in main
        root = Tk(className="Idle")
    File "C:\python26\Lib\lib-tk\Tkinter.py", line 1643, in __init__
        self.tk = _tkinter.creat(screenName, baseName, className, interactive, want
objects, useTk, sync, use)
_tkinter.TclError: Can´t find a usable init.tcl in the following directories:
        C:/Python26/lib/tcl8.5 c:/lib/tcl8.5 c:/lib/tcl8.5 c:/library c:/library c:/
tcl8.5.2/library c:/tcl8.5.2/library
This probably means that Tcl wasn´t installed properly.

So I have reinstall python about 3 to 4 times and I keep getting the same error.

I´ll will for ever be in debt to anyone that gives me a solution to this error.

By the way, I´m running Python 2.6.6 on Win 7 32-Bit.

Thank you.

4条回答
老娘就宠你
2楼-- · 2020-03-07 08:14

This TCL issue has appeared in a number of Python forums and is generally prevents the IDLE GUI from starting e.g. http://www.gossamer-threads.com/lists/python/python/902912 and is related to the TCL_LIBRARY enviroment variables. Try and edit the enviroment variables

Right click on (My) Computer, go to properties, Advanced Tab, press Environment Variables and edit TCL_LIBRARY to indicate the Python path e.g C:\Python26\tcl\tcl8.5 (or enter the path that represents your version. Idle should start then.

I noticed that this is an issue when you install other programs that may depend on the TCL Library. Happened to me after I installed SciLab. Therefore changing the variable may cause issues with another installed app. Hope this helps.

查看更多
可以哭但决不认输i
3楼-- · 2020-03-07 08:15

(Assuming your Python install is not corrupt. Did you make any changes to the Python install, try and install anything else?)

What is your Python install directory? Look under Python_install_directory/tcl , init.tcl should be there, is it? Tell us what you find.

查看更多
我命由我不由天
4楼-- · 2020-03-07 08:16

Hey I don't know why this worked for me but I just right clicked on the the idle icon and clicked "Duplicate". This created another icon "IDLE duplicate", weirdly, and when I try to open this version it works. Hope this helps!

查看更多
疯言疯语
5楼-- · 2020-03-07 08:18

Some folders may have been deleted or removed.

Go to Uninstall Program

Choose Python

Click "Change"

Then click "repair"

Allow the computer to repair....Should work after this.

Some notes*

Always make sure everything is in the same directory that you are working in CMD. I opened up my directory from the cmd and put my files in the same directory.

Check your 'App data' folder too for any Python files.

Be aware that 'App data' folder may be hidden.

Also when you reinstall click customize and python will allow you to make your own customize path location which is helpful and a lot more simple then what python chooses.

查看更多
登录 后发表回答