Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Python 3.11.0 installation and Tkinter does not work

3,741 views
Skip to first unread message

dark...@o2online.de

unread,
Nov 21, 2022, 1:01:36 PM11/21/22
to





Dear list,

I want learn python for 4 weeks and have problems, installing Tkinter. If I installed 3.11.0 for my windows 8.1 from python.org and type

  >>> import _tkinter
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
> ImportError: DLL load failed while importing _tkinter: Das angegebene
> Modul wurde nicht gefunden.

> So I it is a tkinter Problem and I tried this:

>  >>> import _tkinter
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
> ImportError: DLL load failed while importing _tkinter: Das angegebene
> Modul wurde nicht gefunden.

How can I fix this and make it work?






Thomas Passin

unread,
Nov 21, 2022, 4:42:33 PM11/21/22
to
On 11/21/2022 1:24 PM, Stefan Ram wrote:
> dark...@o2online.de writes:
>>>>> import _tkinter
>
> I don't know why you get this error message. Here, I do not
> get an error message from that line. However, the normal way
> to use tkinter, as far as I know, is without the underscore!

You can import both tkinter and _tkinter, though I'm not sure why you
would do the latter for any normal programming.

> I think it might be best if you make sure that a recent
> Visual C++ Redistributable Runtime from Microsoft®
> is installed before you install Python.

That's a worthwhile thought.

> If you have no such Runtime, I have no idea how to proceed!
> Maybe uninstall Python, install the Runtime, and then install
> Python again?

python.org says:

"Note that Python 3.11.0 cannot be used on Windows 7 or earlier"

But maybe there's something about their compilation settings or runtime
support versions that doesn't work with the OP's version of Python 8.1.

Or, since Python itself seems to be running, maybe the way the tkinter
binary was compiled isn't compatible even though Python 3.11 itself is.
Maybe this is a bug waiting to be filed...

I would try installing a lower version, maybe an older version of Python
3.10, and seeing if that works.

> If you have chosen any unusual settings during the installation
> of Python, it might help to try an installation with the suggested
> settings.
>
> I am trying to learn tkinter myself and I am very surprised
> how well it offers exactly what I am looking for! I hope they
> never will remove tkinter from the standard distribution!
>
>

DFS

unread,
Nov 21, 2022, 5:32:37 PM11/21/22
to
When installing Python 3.11.0 did you check the box "tcl/tk and IDLE"?
(it's an option on the Python Windows installer).


I made sure to do that, and then this worked:

import tkinter
from tkinter import filedialog as fd
from tkinter.filedialog import askopenfilename
filename = fd.askopenfilename()
print(filename)

foldername = fd.askdirectory()
print(foldername)
time.sleep(3)


Mats Wichmann

unread,
Nov 22, 2022, 10:23:45 AM11/22/22
to
On 11/21/22 14:41, Thomas Passin wrote:
> On 11/21/2022 1:24 PM, Stefan Ram wrote:
>> dark...@o2online.de writes:
>>>>>> import _tkinter
>>
>>    I don't know why you get this error message. Here, I do not
>>    get an error message from that line. However, the normal way
>>    to use tkinter, as far as I know, is without the underscore!
>
> You can import both tkinter and _tkinter, though I'm not sure why you
> would do the latter for any normal programming.

No, but it's often the advice given when things are not working - see if
the underlying tkinter module can be imported, to verify it's actually
findable, so not surprised to see someone trying it.

Barry

unread,
Nov 22, 2022, 5:19:30 PM11/22/22
to


> On 22 Nov 2022, at 16:09, r...@zedat.fu-berlin.de wrote:
>
> dark...@o2online.de writes:
>>> ImportError: DLL load failed while importing _tkinter: Das angegebene
>>> Modul wurde nicht gefunden.
>
> If you have not already done so, make sure that you install
> Python from python.org.
>
> Then, after the installation, you also should make sure that
> you actually use this installed version.
>
> import sys
> sys.version_info
> import tkinter
>
> It is possible that you have installed a different version
> of Python before and accidentally have opened that version,
> which may not include tkinter.

In which case the error is module not found.
The error reported suggests that a dll that _tkinter needs is missing.

Barry

>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Barry Scott

unread,
Nov 23, 2022, 2:49:08 PM11/23/22
to


> On 23 Nov 2022, at 06:31, Stefan Ram <r...@zedat.fu-berlin.de> wrote:
>
> dark...@o2online.de writes:
>> I want learn python for 4 weeks and have problems, installing Tkinter. If I=
>> installed 3.11.0 for my windows 8.1 from python.org and type
>
> Ok, so you already installed from python.org. I wonder a
> little about the wording "installing Tkinter". Here,
> I installed /Python/ from python.org, and this /included/ tkinter.
> If you have really attempted a separate installation of tkinter,
> it may help to uninstall and instead install Python /including/
> tkinter.
>
>>> ImportError: DLL load failed while importing _tkinter: Das angegebene
>>> Modul wurde nicht gefunden.
>
> Another possibility of analysis is to watch the Python
> process using "Process Monitor" (formerly from Sysinternals)
> under Microsoft® Windows (not to be confused with "Process
> Explorer"). This program requires some familiarization,
> but then it can show you in which directories a process is
> searching for which DLLs. This might help you to find the
> name of the DLL missing and in which directory it should be.

I think the depends.exe tool from sysintenals will do this as well.
There is a mode where you run a program and it collects the data
for all the DLLs that are used either statically linked or dynamicall
loaded, that is the case for _tkinter.

I have not used in in a very long time but I recall it shows errors
from DLLs that failed to load.

Barry


>
>
> --
> https://mail.python.org/mailman/listinfo/python-list

Jason Friedman

unread,
Nov 23, 2022, 9:49:56 PM11/23/22
to
>
> I want learn python for 4 weeks and have problems, installing Tkinter. If
> I installed 3.11.0 for my windows 8.1 from python.org and type
>
> >>> import _tkinter
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in <module>
> > ImportError: DLL load failed while importing _tkinter: Das angegebene
> > Modul wurde nicht gefunden.
>
> > So I it is a tkinter Problem and I tried this:
>
> > >>> import _tkinter
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in <module>
> > ImportError: DLL load failed while importing _tkinter: Das angegebene
> > Modul wurde nicht gefunden.
>
> How can I fix this and make it work?
>

Have a look at
https://stackoverflow.com/questions/25905540/importerror-no-module-named-tkinter
.

Most of the answers are for Linux/Mac, but there are Windows answers there,
too.
0 new messages