我正在运行macOS Sierra 10.12.2并试图让Python的IDLE与Tcl / Tk一起正常工作.这是我打开IDLE时收到的错误消息:
Python 2.7.13 (default, Dec 18 2016, 07:03:39)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable.
Visit http://www.python.org/download/mac/tcltk/ for current information.
访问错误消息中的链接,我阅读了文档并从this源安装了Tcl / Tk版本8.5.18.0.也许重要的是要注意我正在运行Python 2.7.13的brew安装.安装DMG for 8.5.18.0后,bash终端和Python无法识别Tcl / Tk升级(注意它识别Tcl / Tk(8.5.9)而不是8.5.18.0.我怎样才能获得IDLE和从自制软件升级python安装以识别升级的Tcl / Tk 8.5.18.0?换句话说,我该如何解决警告信息?
解决方法:
根据这个Python Software Foundation页面:
The Python for Mac OS X installers downloaded from this website dynamically link at runtime to Tcl/Tk macOS frameworks. The Tcl/Tk major version is determined when the installer is created and cannot be overridden. The Python 64-bit/32-bit Mac OS X installers for Python 3.6.x, 3.5.x, and 2.7.x dynamically link to Tcl/Tk 8.5 frameworks. 32-bit-only Python installers for Mac OS X dynamically link to Tcl/Tk 8.4 frameworks.
In either case, the dynamically linking occurs when tkinter (Python 3) or Tkinter (Python 2) is first imported (specifically, the internal _tkinter C extension module). By default, the macOS dynamic linker looks first in /Library/Frameworks for Tcl and Tk frameworks with the proper major version. This is the standard location for third-party or built from source frameworks, including the ActiveTcl releases. If frameworks of the proper major version are not found there, the dynamic linker looks for the same version in /System/Library/Frameworks, the location for Apple-supplied frameworks shipped with macOS. (Note, you should normally not modify or delete files in /System/Library.)
来源:寻找Python如何在https://www.python.org/download/mac/tcltk/#activetcl-8-5-18-0选择哪个Tk库使用子标题
因此,我99.9%肯定现在你已经更新到Tcl / Tk 8.5.18.0,你需要做的是重新安装Python 2.7.13.
我相信这将解决您的问题的原因是,在阅读我引用的信息后,很明显Python使用的Tcl / Tk版本是在安装过程中选择的,如果不再重新安装Python就无法更改.
原文地址:https://codeday.me/bug/20190817/1681610.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。