You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can't build _tkinter module using brew install on Mac OS X #93659
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_tkinter
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
I tried running brew install python-tk, but it didn't resolve the issue. Any ideas?
First, the python-tk Homebrew package is not the Tcl/Tk headers and libraries. If you want those, you need to install the tcl-tk package:
$ brew update && brew install tcl-tk
Since Python 3.11, configure uses pkg-config to detect Tcl/Tk. Try this:
# install pkg-config
$ brew update && brew install pkg-config
# assuming you now have pkg-config in your path, and you´ve installed the tcl-tk brew:
$ PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig" ./configure
$ make
@erlend-aasland this is great thanks. It resolved the issue with the only caveat that Python build finished successfully! doesn't show anymore.
One question: for this to work when following the documentation, I ran the command line you provided with this in addition: --with-pydebug --with-openssl=$(brew --prefix openssl) (as it is indicated in the documentation)
Is it ok to have such a long command line? I am asking because I would suggest this line as an update to the documentation to be able to build _tkinter.
One more question, is it ok/normal for the message:
Python build finished successfully!
not to show after compiling make -s -j2?
It used to appear just before the message below that is not showing anymore (resolving therefore the current issue I opened):
The necessary bits to build these optional modules were not found:
_tkinter
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
Below the full message I get after running make -s -j2:
Note: Deepfreeze may have added some global objects,
so run 'make regen-global-objects' if necessary.
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: libpython3.12d.a(dynamic_annotations.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: libpython3.12d.a(pymath.o) has no symbols
CC='gcc' LDSHARED='gcc -bundle -undefined dynamic_lookup ' OPT='-g -Og -Wall' ./python.exe -E ./setup.py -q build
ld: warning: directory not found for option '-L/usr/lib/termcap'
renaming build/scripts-3.12/pydoc3 to build/scripts-3.12/pydoc3.12
renaming build/scripts-3.12/idle3 to build/scripts-3.12/idle3.12
renaming build/scripts-3.12/2to3 to build/scripts-3.12/2to3-3.12
One final question: how do you add color to your comments??
@erlend-aasland great thanks very much for your help. For the markdown, I can now see that colors are rendered automatically. I believe there is no way to add colors ourselves. Yes, I created the PR you refer to. I updated it earlier today and it is not relevant anymore to this issue, but I will create a new PR, and link it to this issue for reference.
Activity
erlend-aasland commentedon Jun 10, 2022
First, the
python-tkHomebrew package is not the Tcl/Tk headers and libraries. If you want those, you need to install thetcl-tkpackage:$ brew update && brew install tcl-tkSince Python 3.11,
configureuses pkg-config to detect Tcl/Tk. Try this:izumiberat commentedon Jun 10, 2022
@erlend-aasland this is great thanks. It resolved the issue with the only caveat that
Python build finished successfully!doesn't show anymore.One question: for this to work when following the documentation, I ran the command line you provided with this in addition:
--with-pydebug --with-openssl=$(brew --prefix openssl)(as it is indicated in the documentation)The command line I ran is:
PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig" ./configure --with-pydebug --with-openssl=$(brew --prefix openssl)Is it ok to have such a long command line? I am asking because I would suggest this line as an update to the documentation to be able to build _tkinter.
One more question, is it ok/normal for the message:
not to show after compiling
make -s -j2?It used to appear just before the message below that is not showing anymore (resolving therefore the current issue I opened):
Below the full message I get after running
make -s -j2:One final question: how do you add color to your comments??
erlend-aasland commentedon Jun 10, 2022
Great, so we close this issue! Glad to help 🙂
It seems like that message is only printed if there are missing modules 😆 I guess we should change that; thanks for the heads-up, I'll follow it up.
Yes. You can split it up over multiple lines to make it more readable. Here's my command line to build Python (part of my
build-python.shscript):(Most of the helper variables are set up earlier in the build script.)
That's a very good idea. There's already a PR up regarding this; you could chime in there: python/devguide#891
GitHub Markdown
For the command examples in my previous post, I used three backticks fencing with the
consolehighlighting keyword:izumiberat commentedon Jun 10, 2022
@erlend-aasland great thanks very much for your help. For the markdown, I can now see that colors are rendered automatically. I believe there is no way to add colors ourselves. Yes, I created the PR you refer to. I updated it earlier today and it is not relevant anymore to this issue, but I will create a new PR, and link it to this issue for reference.
erlend-aasland commentedon Jun 10, 2022
Yeah, the colours are rendered automatically, but you've got a lot of different highlighting keywords to choose from (
python,c,json,bash, etc.)