I have a python3.7 installed via brew
on my Ubuntu 18.04. I can't make tkinter
to work:
~ python3.7 -c "import tkinter"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/homes/0x90/.linuxbrew/opt/[email protected]/lib/python3.7/tkinter/__init__.py", line 36, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'
This is the info of my tcl-tk and python3.7 environment:
~ brew info tcl-tk tcl-tk: stable 8.6.12
Tool Command Language
https://www.tcl-lang.org
/homes/0x90/.linuxbrew/Cellar/tcl-tk/8.6.12_1 (3,029 files, 35.9MB) *
Built from source on 2022-01-03 at 18:01:40
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/tcl-tk.rb
License: TCL
==> Dependencies
Build: freetype ✔, pkg-config ✔
Required: [email protected] ✔, zlib ✔, libx11 ✔, libxext ✔
==> Caveats
The sqlite3_analyzer binary is in the `sqlite-analyzer` formula.
==> Analytics
install: 411,232 (30 days), 881,024 (90 days), 3,393,796 (365 days)
install-on-request: 13,076 (30 days), 112,501 (90 days), 256,514 (365 days)
build-error: 54 (30 days)
and obviously:
~ which python3.7
/homes/0x90/.linuxbrew/opt/[email protected]/bin/python3.7
Note that I even tried to define the following environment variables but with or without them it fails to load tkinter
as suggested on this thread:
setenv PATH /homes/0x90/.linuxbrew/Cellar/tcl-tk/8.6.12_1/bin:$PATH
setenv PKG_CONFIG_PATH /homes/0x90/.linuxbrew/Cellar/tcl-tk/8.6.12_1/lib/pkgconfig:$PKG_CONFIG_PATH
0 Answers