Mac安裝Python3税灌,遇到IDLE中無法輸入中文的問題验毡,shell中顯示如下警告
Python 3.6.4 (v3.6.4:d48ecebad5, Dec 18 2017, 21:07:28)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable.
上網(wǎng)百度之头朱,猜測是因為mac預(yù)裝的tcl-tk8.5.9版本不穩(wěn)定,于是使用homebrew升級至最新版本的8.6.6版本婉商,發(fā)現(xiàn)還是不起作用似忧,觀察命令行中發(fā)現(xiàn)有如下提示:
This formula is keg-only, which means it was not symlinked into /usr/local,
because tk installs some X11 headers and macOS provides an (older) Tcl/Tk.
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/tcl-tk/bin:$PATH"' >> ~/.bash_profile
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/tcl-tk/lib
CPPFLAGS: -I/usr/local/opt/tcl-tk/include
于是按照提示修改配置文件發(fā)現(xiàn)還是不行查詢當(dāng)前tcl-tk版本顯示如下
~ hetunyu$ tclsh
% info patchlevel
8.6.6
但是IDLE中的Tk version一直顯示8.5.9
About IDLE
很困惑,上網(wǎng)百度丈秩、google盯捌,答案是讓重新使用homebrew方式安裝python3
brew reinstall python3 --with-tcl-tk
但是我想嘗試找一下原因,于是瀏覽python官方網(wǎng)站其中提到:How Python Chooses Which Tk Library To Use
Python Choose TK.png
顯示Python并不能自動關(guān)聯(lián)Tcl/Tk的8.6版本蘑秽,只會關(guān)聯(lián)8.5饺著,所以一直會使用系統(tǒng)自帶的8.5.9。
知道原因后在activetcl網(wǎng)站重新下載8.5.18.0版本肠牲,點擊安裝幼衰,重新運行IDLE,沒有任何警告缀雳。希望能給需要的朋友節(jié)約點時間~