Well, it’s an easy way to directly load tkinter. If it works and import tkinter as tk does not, you may have something already defined as tk. That’s what seems to happen, the op has tensorkit package as tk.
They installed tensorkit, which makes it available to import, presumably like so: import tk or import tk as tensorkit.
However they imported tkinter, which in turn imported _tkinter which complained that libtk8.6.so is missing.
libtk8.6.so is owned by the tk package in the repos (not to be confused with tensorkit), so either OP has an old version, it’s not installed, or something weird is going on.
I deinstalled tk and changed my code to your suggestion, but there is still the same error. If i run: $ pip3 show tkinter
then there is the output: WARNING: Package(s) not found: tkinter
Looking at it calmly, @dmt is right, the libtk8.6.so library that comes with the tk package is missing. You can check if it is in your system with this command:
ls /usr/lib/libtk8.6.so
That library comes with the manjaro tk package. You can install it with:
warning: tk-8.6.13-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...
Packages (1) tk-8.6.13-1
Total Installed Size: 4.84 MiB
Net Upgrade Size: 0.00 MiB
:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring [######################] 100%
(1/1) checking package integrity [######################] 100%
(1/1) loading package files [######################] 100%
(1/1) checking for file conflicts [######################] 100%
(1/1) checking available disk space [######################] 100%
:: Processing package changes...
(1/1) reinstalling tk [######################] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
but die error still exists. If I try to run the programm in vscode der is still:
bin/python /home/(my username)/Dokumente/Programmieren/Python/SpielTkinter.py
Traceback (most recent call last):
File "/home/(my username)/Dokumente/Programmieren/Python/SpielTkinter.py", line 1, in <module>
from tkinter import *
ModuleNotFoundError: No module named 'tkinter'
preferably don’t use VSCode. Use IDLE or Spyder or PyCharm.or KDE Develop or something else.
Where are you using pip install … ? It is preferable that you use pip install … in a Python virtual Environment. But if you have set up the pyvenv then tkinter will be included in the venv.