cubefull.blogg.se

Install tkinter for python on mac
Install tkinter for python on mac










As the result you should see your $PATH contents with tcl-tk highlighted Run echo $PATH | grep -color=auto tcl-tk.

  • after reloaded check that tck-tk is in $PATH.
  • reload shell by quitting Terminal app or run source ~/.zshrc.
  • in shell run echo 'export PATH="/usr/local/opt/tcl-tk/bin:$PATH"' > ~/.zshrc.
  • Here is step by step guide to make tkinter (and IDLE) work if you use pyenv for Python environments management on macOS: Set TK_SILENCE_DEPRECATION=1 to suppress this warning. DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. If you get the following error, you might be missing the PYTHON_CONFIGURE_OPTS env. PYTHON_CONFIGURE_OPTS="-with-tcltk-includes='-I$(brew -prefix tcl-tk)/include' -with-tcltk-libs='-L$(brew -prefix tcl-tk)/lib -ltcl8.6 -ltk8.6'" \ PKG_CONFIG_PATH="$(brew -prefix tcl-tk)/lib/pkgconfig" \ĬFLAGS="-I$(brew -prefix tcl-tk)/include" \ LDFLAGS="-L$(brew -prefix tcl-tk)/lib" \ĬPPFLAGS="-I$(brew -prefix tcl-tk)/include" \ PATH="$(brew -prefix tcl-tk)/bin:$PATH" \ Next, reinstall Python with the environment variables active: ※ pyenv uninstall 3.8.1 You'll also need to know about pyenv's PYTHON_CONFIGURE_OPTS, -with-tcltk-includes, and -with-tcltk-libs, e.g. If you need to have tcl-tk first in your PATH run:Įcho 'export PATH="/usr/local/opt/tcl-tk/bin:$PATH"' > ~/.zshrcįor compilers to find tcl-tk you may need to set:Įxport LDFLAGS="-L/usr/local/opt/tcl-tk/lib"Įxport CPPFLAGS="-I/usr/local/opt/tcl-tk/include"įor pkg-config to find tcl-tk you may need to set:Įxport PKG_CONFIG_PATH="/usr/local/opt/tcl-tk/lib/pkgconfig" Tcl-tk is keg-only, which means it was not symlinked into /usr/local,īecause tk installs some X11 headers and macOS provides an (older) Tcl/Tk.

    Install tkinter for python on mac install#

    mentioned in tcl-tk's caveats and this GitHub comment when installing new Pythons via pyenv to get tkinter.įirst, ensure you have the latest tcl-tk via homebrew and then pay attention to its caveats: ※ brew install tcl-tk RuntimeError: tk.h version (8.6) doesn't match libtk.a version (8.5) Raise RuntimeError("tk.h version (%s) doesn't match libtk.a version (%s)"

    install tkinter for python on mac

    Set TK_SILENCE_DEPRECATION=1 to suppress this warning.įile "/Users/factor/.pyenv/versions/3.8.1/lib/python3.8/tkinter/_init_.py", line 4552, in _testįile "/Users/factor/.pyenv/versions/3.8.1/lib/python3.8/tkinter/_init_.py", line 2263, in _init_įile "/Users/factor/.pyenv/versions/3.8.1/lib/python3.8/tkinter/_init_.py", line 2279, in _loadtk Or you might get a message about the header version doesn't match the binary: DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. ModuleNotFoundError: No module named '_tkinter' Import _tkinter # If this fails your Python may not be configured for Tk Type "help", "copyright", "credits" or "license" for more information.įile "/Users/factor/.pyenv/versions/3.8.1/lib/python3.8/tkinter/_init_.py", line 36, in Versions of Python installed via pyenv fail to import tkinter: ※ python










    Install tkinter for python on mac