[Python] Python 3.13.5 Ctypes and Tkinter imports not working

Discussão em 'Python' iniciado por Stack, Julho 30, 2025.

  1. Stack

    Stack Membro Participativo

    So I installed python 3.13.5 today and tried to run my projects with ctypes and tkinter.
    It had worked fine before the installation, but it didn't work after

    When I ran my project with ctypes in it gave me this error:

    Traceback (most recent call last):

    File "C:\Users\SomePerson\PycharmProjects\PYTHON\Test.py", line 134, in <module>

    import ctypes

    File "C:\Users\SomePerson\AppData\Local\Programs\Python\Python313\Lib\ctypes\__init__.py",line

    157, in <module>

    class py_object(_SimpleCData):

    ...<5 lines>...

    return "%s(<NULL>)" % type(self).__name__

    AttributeError: class must define a '_type_' attribute


    After that I was quite confused and I ran another project, this one having only tkinter (I am

    certain that I checked "Install Tk/Tcl" or something when I installed python 3.13.5). After I

    ran it, this happened:

    Traceback (most recent call last): File "C:\Users\SomePerson\PycharmProjects\PYTHON\Test.py",

    line 134, in

    <module>

    import tkinter
    ^^^^^^^^^^^^^^

    File "C:\Users\SomePerson\AppData\Local\Programs\Python\Python313\Lib\tkinter_init_.py", line 38, in

    <module>

    import _tkinter # If this fails your Python may not be configured for Tk
    ^^^^^^^^^^^^^^^

    ImportError: DLL load failed while importing _tkinter: The specified procedure could not be

    found.


    I think my python installation was not installed correctly because when I try reinstalling old version it gives me this error (the old version I used was 3.13.0, and it worked the last time I used it)

    Error1:

    [​IMG]

    And then after that it would uninstall and give me this error

    Error2:

    [​IMG]

    I even tried finding the corrupt python 3.13.5 files in Windows File Explorer but I had no idea where they are located

    Continue reading...

Compartilhe esta Página