终端 – 警告:正在使用的Tcl / Tk(8.5.9)版本可能不稳定

我正在运行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就无法更改.

相关文章

最近做自动化测试时,深感自己对前端涉猎太少,加上对这块比...
homebrew本身就是一个git仓库。使用homebrew安装软件包时,会...
一、Homebrew安装、卸载等命令Homebrew的安装和卸载都非常简...
在mac系统中,使用homebrew可以很方便的管理包。按照官网的说...
我按照说明从这里使用brew安装mysqlhttps://gist.github.com...
我在macOS10.12.4上安装了nginx1.10.3和php5.5.38作为开发服...