Python IDLE 无法在 Windows 7 上启动

发布于 2024-09-14 09:39:13 字数 195 浏览 10 评论 0 原文

我曾经使用Python 2.7,然后IDLE就可以工作了。我卸载了它并安装了Python 3.1。
现在 Idle 无法启动。我应该做什么才能让它运行?

笔记: 我尝试了 c:\Python31\pythonw.exe c:\Python31\Lib\idlelib\idle.py
我卸载了3.1并重新安装了2.7,两者都不起作用......

I used to use Python 2.7 and then IDLE was working. I uninstalled it and installed Python 3.1.
Right now Idle cannot launch. What should i do to get it running?

NOTE:
I tried c:\Python31\pythonw.exe c:\Python31\Lib\idlelib\idle.py
i uninstalled 3.1 and installed back 2.7, not working neither...

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

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

发布评论

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

评论(10

西瑶 2024-09-21 09:39:13

我在 Windows 10 上遇到了同样的问题。解决问题的步骤:

  1. 在您的个人资料目录中找到 .idlerc 文件夹(例如 C:\Users\{your-username}没有大括号)。
  2. 删除 .idlerc 目录。

它对我有用......

I got the same problem on window 10. Steps to solve the problem:

  1. Locate the .idlerc folder in your profile directory (e.g. C:\Users\{your-username} without the braces).
  2. Delete the .idlerc directory.

It worked for me...

药祭#氼 2024-09-21 09:39:13

过去,我经常发现,当我对某些 Python 版本的 python.org 版本(特别是在 Windows 上)遇到一些问题时,我会安装 activepython 版本使问题消失。所以,从你的角度来看,我首先要尝试的是 ActivePython(我认为他们还没有 2.7——它可能存在的时间还太短——但他们肯定有 3.1)。

编辑:已添加版本 2.5、2.6、2.7、3.2、3.3 和 3.4。

In the past, I've often found that when I had some issues with the python.org version of some Python release, specifically on Windows, installing instead the activepython version of the same release, from ActiveState, made the problems go away. So, in your shoes, the first thing I would try would be ActivePython (I don't think they have a 2.7 yet -- it's probably been around for too short a time yet -- but they definitely do have a 3.1).

EDIT: Versions 2.5, 2.6, 2.7, 3.2, 3.3, and 3.4 have been added.

彼岸花似海 2024-09-21 09:39:13

我也面临同样的问题。但最后是这样解决的-->

以管理员身份运行Python\Lib\idlelib\idle.py,出现无法打开文件“recent-files.lst”的错误。

因此,转到您的主文件夹,显示隐藏文件,单击 .idlerc 并删除名为“recent-files”的文件。现在 IDLE 正在工作...

I too faced the same problem. But at last solved like this -->

Run Python\Lib\idlelib\idle.py as admin, i got the error that the file "recent-files.lst" can't be opened.

So go to your home folder, show hidden files, click on .idlerc and delete the file named "recent-files". Now IDLE is working...

瀞厅☆埖开 2024-09-21 09:39:13

我的系统是Win7/64企业版,Python版本是2.7.3(我需要这个...)。
这是我从命令窗口运行idle.py时得到的结果:

"
C:\Python27\Lib\idlelib>idle.py
Traceback (most recent call last):
  File "C:\Python27\Lib\idlelib\idle.py", line 11, in <module>
    idlelib.PyShell.main()
  File "C:\Python27\Lib\idlelib\PyShell.py", line 1406, in main
    root = Tk(className="Idle")
  File "C:\Python27\lib\lib-tk\Tkinter.py", line 1685, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, want
objects, useTk, sync, use)
_tkinter.TclError: Can't find a usable init.tcl in the following directories:
    {C:\Program Files (x86)\CSR\BlueSuite 2.5.0} C:/Python27/lib/tcl8.5 C:/lib/t
cl8.5 C:/lib/tcl8.5 C:/library C:/library C:/tcl8.5.2/library C:/tcl8.5.2/librar
y

This probably means that Tcl wasn't installed properly.
"

确实,上面列出的任何位置都没有“tcl8.5”文件夹,但它位于:
“C:\Python27\tcl”。

当我将其复制到“C:\Python27\lib”下时,IDLE 启动(带有一些其他警告,但这似乎与我的公司环境有关......)

总之,这看起来像是安装程序无法将文件夹复制到它应该在的位置无法正确设置某些环境变量,或者该版本存在实际错误,可能会出现在某些版本的 Win7/64 上。
我不是一个足以调试Python本身的Python专家,所以请有人从这里拿走它......同时我会看看“解决方法”是否足够好:-)

My system is Win7/64 Enterprise edition and the Python version is 2.7.3 (I need this one...).
This is what I got when I ran idle.py from the command window:

"
C:\Python27\Lib\idlelib>idle.py
Traceback (most recent call last):
  File "C:\Python27\Lib\idlelib\idle.py", line 11, in <module>
    idlelib.PyShell.main()
  File "C:\Python27\Lib\idlelib\PyShell.py", line 1406, in main
    root = Tk(className="Idle")
  File "C:\Python27\lib\lib-tk\Tkinter.py", line 1685, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, want
objects, useTk, sync, use)
_tkinter.TclError: Can't find a usable init.tcl in the following directories:
    {C:\Program Files (x86)\CSR\BlueSuite 2.5.0} C:/Python27/lib/tcl8.5 C:/lib/t
cl8.5 C:/lib/tcl8.5 C:/library C:/library C:/tcl8.5.2/library C:/tcl8.5.2/librar
y

This probably means that Tcl wasn't installed properly.
"

Indeed there was no "tcl8.5" folder in any of the listed above place but it was under:
"C:\Python27\tcl".

When I copied it under "C:\Python27\lib" then IDLE started (with some other warnings but this seems related to my corp environment...)

In conclusion this looks like either an installer failing to copy the folder where it is supposed to or failing to set up some environment variables correctly or there's an actual bug int the release likely to show up on Win7/64 on certain edition(s).
I am not a Python expert enough to debug Python itself, so please somebody take it from here...in the meantime I will see if the "workaround" is good enough :-)

感情洁癖 2024-09-21 09:39:13

只需尝试删除您的个人资料中以 .idlerc 结尾的文件即可。

1. Enter <win-r>, and type %USERPROFILE%\.idlerc
2. delete all files in idlerc folder
3. it works on my PC(win7 OS)

Just try to delete the files which end with .idlerc in your profile.

1. Enter <win-r>, and type %USERPROFILE%\.idlerc
2. delete all files in idlerc folder
3. it works on my PC(win7 OS)
终陌 2024-09-21 09:39:13

我也遇到了这种奇怪的情况,并做了一些故障排除。作为一项严格的任务,卸载并重新安装 python 版本(2.6、2.7、3.1)以及我所有相关的扩展和其他站点包:除了其他人提供的后续选项之外,可能有也可能没有已帮助解决 IDLE 正常工作的问题。我发现,在 64 位系统上安装 32 位 .msi 会导致 tkinter 出现运行时 .dll 错误,从而导致 IDLE 无法正常启动,或者根本无法启动。小心一点,不要像我一样盲目……:)

I ran into this weird situation also, and did a bit of troubleshooting. As a rigorous task, uninstalling, and re-installing the versions of python(2.6, 2.7, 3.1) and all my associated extensions and other site packages: in addition to the subsequent options that others have provided, that may have, or may not have, helped fix issues with the IDLE working properly. I found and error on my part, installing a 32 bit .msi on a 64 bit system causes a runtime .dll error with tkinter and therfore, causes IDLE to not start up properly, or not at all. Be mindful, and don't be a blind bat like me... :)

仅此而已 2024-09-21 09:39:13

一旦我按照 Bogdan 的回答中的建议将 C:\Python27\tcl\tcl8.5 文件夹复制到 C:\Python27\Lib ,错误消息 “这可能意味着 Tcl 没有正确安装” 消失了。相反,我开始看到“这可能意味着 tk 没有正确安装”。我还必须将 C:\Python27\tcl\tk8.5 文件夹复制到 C:\Python27\Lib 。一旦我这样做了,从 C:\Python27\Lib\idlelib 中的命令行运行 idle.py 就没有错误了。

Once I copied the C:\Python27\tcl\tcl8.5 folder to C:\Python27\Lib as suggested in Bogdan's answer the error message "This probably means that Tcl wasn't installed properly" went away. Instead I started seeing "This probably means that tk wasn't installed properly". I had to copy the C:\Python27\tcl\tk8.5 folder to C:\Python27\Lib as well. Once I did that running idle.py from the command line in C:\Python27\Lib\idlelib was error-free.

相思碎 2024-09-21 09:39:13

运行python安装程序,更改python 2x,选择完全删除tcl/tk,继续,然后再次运行安装程序,再次更改python,在tcl\tk上选择将安装整个功能,继续。

这对我有用。

Run python setup program, change python 2x, choose to entirely remove tcl/tk, proceed, then run setup again, change python again, on the tcl\tk choose entire feature will be installed, proceed.

It worked for me.

海未深 2024-09-21 09:39:13

即使我的代码也面临同样的问题,但现在已经解决了。
我使用的是 2.6,它有旧版本的 Xlrd,所以我使用 pip 在 2.7 中更新了 xlrd,并用 2.7 打开了我的文件,它可以工作。

Even I was facing same issue with my code, But It is resolved now.
I was using 2.6 which was having old version of Xlrd, so I updated xlrd in 2.7 using pip and I opened my file with 2.7 and it works.

心凉 2024-09-21 09:39:13

按照上面的建议删除 .idlerc 目录,再次运行 python 安装程序并选择修复。如果需要,将 .py 文件与 Python27 文件夹中的 python.exe 可执行文件关联。删除 python 3.7 后这对我有用。

Delete the .idlerc directory as suggested above, run the python installer again and choose repair. If needed associate the .py files with the python.exe executable in Python27 folder. This worked for me after removing python 3.7.

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