I am trying to run this example in a .venv with python 3.12 on my ubuntu 18.04 machine :
https://matplotlib.org/stable/gallery/misc/multiprocess_sgskip.html
Note I have donwloaded pyhton 3.12 from https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz and have build from source.
I get the following error message :
FigureCanvasAgg is non-interactive, and thus cannot be shown
and so I have updated the code with
import tkintermatplotlib.use('agg')
and get this error :
import tkinter File "/usr/local/lib/python3.12/tkinter/__init__.py", line 38, in <module> import _tkinter # If this fails your Python may not be configured for Tk ^^^^^^^^^^^^^^^ModuleNotFoundError: No module named '_tkinter'
When I use :
sudo apt-get install python3-tk
I get the message :
python3-tk is already the newest version (3.6.9-1~18.04).
I just to do not how to install python3-tk for python 3.12.
EDIT :
Following :
I have uninstalled 3.12.0 and have :
- installed
tk-dev
- installed 3.12.2 from source
And it still does not work.
Python 3.12.2 (main, Mar 18 2024, 15:59:21) [GCC 7.5.0] on linuxType "help", "copyright", "credits" or "license" for more information.>>> import tkinterTraceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.12/tkinter/__init__.py", line 38, in <module> import _tkinter # If this fails your Python may not be configured for Tk ^^^^^^^^^^^^^^^ModuleNotFoundError: No module named '_tkinter'>>> exit()user@user-Precision-T3610:/usr/local/bin$ apt list tk-devListing... Donetk-dev/bionic,now 8.6.0+9 amd64 [installed]user@user-Precision-T3610:/usr/local/bin$ cd /usr/local/lib/python3.12/tkinter/user@user-Precision-T3610:/usr/local/lib/python3.12/tkinter$ lscolorchooser.py constants.py dnd.py font.py __main__.py __pycache__ simpledialog.py ttk.pycommondialog.py dialog.py filedialog.py __init__.py messagebox.py scrolledtext.py tix.py