[Python] ModuleNotFoundError: No module named '_tkinter' when installing python 3.12.0 using...

Discussão em 'Python' iniciado por Stack, Junho 28, 2025.

  1. Stack

    Stack Membro Participativo

    I'm tryiny to install latest python 3.12.0 in Fedora 38 using pyenv. The command is pyenv install 3.12.0

    I get below error -

    ~ pyenv install 3.12.0
    Downloading Python-3.12.0.tar.xz...
    -> https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tar.xz
    Installing Python-3.12.0...
    Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/home/raj/.pyenv/versions/3.12.0/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'
    WARNING: The Python tkinter extension was not compiled and GUI subsystem has been detected. Missing the Tk toolkit?
    Installed Python-3.12.0 to /home/raj/.pyenv/versions/3.12.0


    I also installed tkinter in fedora but its version is 3.11.6.

    ~ sudo dnf install python3-tkinter -y
    Last metadata expiration check: 1:29:18 ago on Tue 17 Oct 2023 09:30:15 PM PDT.
    Package python3-tkinter-3.11.6-1.fc38.x86_64 is already installed.
    Dependencies resolved.


    How can I fix this error?

    Note:

    OS Details

    ~ lsb_release -a
    LSB Version: :core-4.1-amd64:core-4.1-noarch
    Distributor ID: Fedora
    Description: Fedora release 38 (Thirty Eight)
    Release: 38
    Codename: ThirtyEight


    pyenv version

    ~ pyenv --version
    pyenv 2.3.30

    Continue reading...

Compartilhe esta Página