导入 tkinter 产生错误

发布于 2024-11-27 05:11:32 字数 804 浏览 1 评论 0原文

开始关于 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

有什么建议吗?

Starting the Open Book on Python 3.1

import turtle #this yields an error from importing tkinter

Script:

import tkinter
exit()

Yields:

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

Any suggestions?

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

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

发布评论

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

评论(1

时光磨忆 2024-12-04 05:11:32

你的Python安装不正确,有问题的库是为错误的架构编译的,可能是错误的处理器,或者是32位,而它应该是64位,或类似的。无论如何,这都不是编程错误。

Your Python is incorrectly installed, the library in question has been compiled for the wrong architecture, maybe the wrong processor or for 32 bit when it should have been 64, or similar. In any case this is not a programming error.

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