FAQ
Hi. I'm having a problem trying to get this to work well. Basically,
whenever I try to
import tkinter, this is the issue that I have:

import tkinter
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.3/tkinter/__init__.py", line 40, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named '_tkinter'


I'm running Ubuntu. If I need to provide any further info, please let me
know.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130318/51814baa/attachment-0001.html>

Search Discussions

  • Ritchie Flick at Mar 18, 2013 at 6:22 pm
    Seems tkinter is missing in standard installation in ubuntu. Try:
    sudo apt-get install python3-tk




    On Mon, Mar 18, 2013 at 6:17 PM, Yves S. Garret
    wrote:

    Hi. I'm having a problem trying to get this to work well. Basically,
    whenever I try to
    import tkinter, this is the issue that I have:
    import tkinter
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/local/lib/python3.3/tkinter/__init__.py", line 40, in <module>
    import _tkinter # If this fails your Python may not be configured for
    Tk
    ImportError: No module named '_tkinter'

    I'm running Ubuntu. If I need to provide any further info, please let me
    know.

    --
    http://mail.python.org/mailman/listinfo/python-list



    --
    Ritchie Flick
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/python-list/attachments/20130318/28f1d3ba/attachment.html>
  • Yves S. Garret at Mar 18, 2013 at 6:29 pm
    I have. This is what I did and the result that I'm seeing.


    $ sudo apt-get install python3-tk
    [sudo] password for ysg:
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    python3-tk is already the newest version.
    python3-tk set to manually installed.
    0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
    $ python3
    Python 3.3.0 (default, Mar 11 2013, 15:04:13)
    [GCC 4.5.2] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    import tkinter
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/local/lib/python3.3/tkinter/__init__.py", line 40, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
    ImportError: No module named '_tkinter'
    >>>


    :-/


    On Mon, Mar 18, 2013 at 2:22 PM, Ritchie Flick wrote:

    Seems tkinter is missing in standard installation in ubuntu. Try:
    sudo apt-get install python3-tk


    On Mon, Mar 18, 2013 at 6:17 PM, Yves S. Garret <
    yoursurrogategod at gmail.com> wrote:
    Hi. I'm having a problem trying to get this to work well. Basically,
    whenever I try to
    import tkinter, this is the issue that I have:
    import tkinter
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/local/lib/python3.3/tkinter/__init__.py", line 40, in
    <module>
    import _tkinter # If this fails your Python may not be configured for
    Tk
    ImportError: No module named '_tkinter'

    I'm running Ubuntu. If I need to provide any further info, please let me
    know.

    --
    http://mail.python.org/mailman/listinfo/python-list

    --
    Ritchie Flick
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/python-list/attachments/20130318/3b475577/attachment-0001.html>
  • Lele Gaifax at Mar 18, 2013 at 6:39 pm

    "Yves S. Garret" <yoursurrogategod@gmail.com> writes:


    I have. This is what I did and the result that I'm seeing.

    $ sudo apt-get install python3-tk

    You installed a "custom" python 3.3, didn't you? So it does not help
    installing Ubuntu's python3-tk: your python3.3 interpreter won't even
    look into "system" packages.


    Most probably, you need to install the proper development libraries and
    *recompile* the Python 3.3 interpreter:


    # apt-get install tk-dev


    ciao, lele.
    --
    nickname: Lele Gaifax | Quando vivr? di quello che ho pensato ieri
    real: Emanuele Gaifas | comincer? ad aver paura di chi mi copia.
    lele at metapensiero.it | -- Fortunato Depero, 1929.
  • Yves S. Garret at Mar 19, 2013 at 1:52 am

    On Monday, March 18, 2013 2:39:57 PM UTC-4, Lele Gaifax wrote:
    "Yves S. Garret" <yo....@gmail.com> writes:
    I have. This is what I did and the result that I'm seeing.

    $ sudo apt-get install python3-tk
    You installed a "custom" python 3.3, didn't you? So it does not help
    installing Ubuntu's python3-tk: your python3.3 interpreter won't even
    look into "system" packages.

    Most probably, you need to install the proper development libraries and
    *recompile* the Python 3.3 interpreter:

    # apt-get install tk-dev

    ciao, lele.
    --
    nickname: Lele Gaifax | Quando vivr? di quello che ho pensato ieri
    real: Emanuele Gaifas | comincer? ad aver paura di chi mi copia.
    le.. at metapensiero.it | -- Fortunato Depero, 1929.

    Ok, it now seems to work. Weird. I had tk-dev installed (it seems) and then
    after I re-compiled my interpreter just now, it's working.


    Thanks for your help.
  • Terry Reedy at Mar 19, 2013 at 3:39 am

    On 3/18/2013 9:52 PM, Yves S. Garret wrote:


    Ok, it now seems to work. Weird. I had tk-dev installed (it seems)
    and then after I re-compiled my interpreter just now, it's working.

    If your previous compilation was before tk-dev was installed, it will
    not have compiled _tkinter properly. On PC, one also has to re-compile
    after doing equivalent of downloading tk-dev.


    --
    Terry Jan Reedy

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedMar 18, '13 at 5:17p
activeMar 19, '13 at 3:39a
posts6
users4
websitepython.org

People

Translate

site design / logo © 2022 Grokbase