I\'ve installed my Python via homebrew on Mac.
brew install python
and after that I\'ve checked my python version as 2.7.11, then I\'ve tri
Below is now outdated. You'll have to install Python directly from python.org if you want to remove those warnings.
2018 Update
brew reinstall python --with-tcl-tk
Note: Homebrew now uses Python 3 by default - Homebrew Blog. Docs.
python
should bring up system’s Python 2, python3
should bring up Python 3.
idle
points to system Python/tcl-tk. It will show an out-dated tcl-tk error (unless you brew install python@2 --with-tcl-tk
)
idle3
should bring up Python 3 with no warnings.
--with-tcl-tk
will install python
directly from python.org, which you'll see when you run brew info python
.
More info here.
On mac OSX you must install TCL separately:
You will find instructions and dowloadables here: https://www.tcl.tk/software/tcltk/ and there: http://wiki.tcl.tk/1013
It requires a little bit of effort, but it is neither complicated nor difficult.
It may be because you don't have the latest Xcode command line tools so brew built python from source instead of from bottle. Try:
xcode-select --install
brew uninstall python
brew install python --use-brewed-tk
If you're using pyenv
you can try installing tcl-tk
via homebrew and then activating the env. vars. mentioned in its caveats section, as detailed in this answer. Activating those env. vars. prior to installing python via homebrew may work for you:
※ export PATH="/usr/local/opt/tcl-tk/bin:$PATH"
※ export LDFLAGS="-L/usr/local/opt/tcl-tk/lib"
※ export CPPFLAGS="-I/usr/local/opt/tcl-tk/include"
※ export PKG_CONFIG_PATH="/usr/local/opt/tcl-tk/lib/pkgconfig"
※ brew reinstall python
Based on the comments from above and the fact that Python must be linked to Tcl/Tk framework:
If you don't have Xcode command line tools, install those:
xcode-select --install
If you don't have Tcl/Tk brew installation (check brew list), install that:
brew install tcl-tk
Then, run "brew uninstall python" if that was not installed with option --with-tcl-tk (the current official option). Then install Python again, linking it to the brew installed Tcl/Tk:
brew install python --with-tcl-tk
It is a bit more complicated now, true you still need to have xcode command line tools and homebrew as a start. But the procedure changes constantly. Homebrew took out tcl-tk support long ago, and apple still only supplies v8.5 of tcl-tk. Anyway, it is possible, and I maintain a github gist personally to fix these issues.
Latest update is using python 3.8.1 (will probably be usable on the 3.8.x branch later too) see here, just follow the steps outlined. github gist link to install tcl-tk with python