【问题标题】:import tkinter yields error导入 tkinter 产生错误
【发布时间】:2011-07-31 13:55:40
【问题描述】:

在 Python 3.1 上启动 Open Book

import turtle #this yields an error from importing tkinter

脚本:

import tkinter
exit()

产量:

Traceback (most recent call last):
  File "imptk.py", line 1, in <module>
    import tkinter
  File "/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/tkinter/__init__.py", line 39, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/lib-dynload/_tkinter.so, 2): no suitable image found.  Did find:
    /Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/lib-dynload/_tkinter.so: mach-o, but wrong architecture

有什么建议吗?

【问题讨论】:

    标签: python-3.x tkinter turtle-graphics


    【解决方案1】:

    您的 Python 安装不正确,有问题的库已针对错误的架构编译,可能是错误的处理器或 32 位(应该是 64 位)或类似的。无论如何,这不是编程错误。

    【讨论】:

    • 谢谢。我卸载了 3.1,安装了 3.2.1 和 ActiveTcl 8.5.10.1,不再出现 tkinter 错误。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-03
    • 1970-01-01
    • 2011-07-21
    • 2017-01-30
    • 2012-03-20
    • 1970-01-01
    相关资源
    最近更新 更多