【问题标题】:Trying to run python 2 and python 3 on the same machine, having problems with 2.7 tkinter尝试在同一台机器上运行 python 2 和 python 3,遇到 2.7 tkinter 问题
【发布时间】:2013-12-25 07:03:13
【问题描述】:

我的机器上的 python 2.7 运行良好。我决定在我的计算机上安装 python 3.3 并将我的环境变量路径更改为 C:\Python33,打算将其作为我的主要路径。在 python 3.3 上运行 IDLE 工作得很好,但由于某种原因,python 2.7 中的 IDLE(和 Tkinter)不再工作。当我在命令提示符下运行以下命令时:

PS C:\python27\lib\idlelib> C:\python27\python.exe idle.py
** IDLE can't import Tkinter. Your python may not be configured for Tk. **

显然我做错了什么,或者我安装的 3.3 搞砸了。有人可以帮忙吗?

【问题讨论】:

  • sys.path 应该包含'C:\python27\DLLs'。该目录应包含 _tkinter.pyd、tcl85.dll、tk85.dll 和 tclpip85.dll 的其他文件。

标签: python python-2.7 python-3.x tkinter python-idle


【解决方案1】:

这只是一个想法,但 python 2.7 和 3.3 版本在编码前输入和原始输入方面存在细微差别。所以我认为如果你在 3.3 编译器上运行你的 2.7 代码,版本开发人员会例外。

我的建议最好为两个版本设置 2 个环境变量,因为正如我之前所说的,语法不同于 2.7 到 3.3 次要的方式。

【讨论】:

    【解决方案2】:

    我的记忆力并不完美...但后来遇到这个问题并想知道,我最终通过卸载两个版本(我知道很痛苦)并重新安装 Python 3.3 首先解决了我的问题 strong> 和 Python 2.7 第二。出于某种原因,在此之后我能够毫无问题地运行两个版本的 IDLE(在它们各自的文件夹中)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-05
      • 1970-01-01
      • 1970-01-01
      • 2010-11-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-14
      相关资源
      最近更新 更多