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

Installing Python 3.8.3 with tkinter

200 views
Skip to first unread message

Klaus Jantzen

unread,
Jul 22, 2020, 11:05:31 AM7/22/20
to
Hi,

Trying to install Python 3.8.3 with tkinter I run configure with the
following options

./configure --enable-optimizations --with-ssl-default-suites=openssl
--with-openssl=/usr/local --enable-loadable-sqlite-extensions
--with-pydebug --with-tcltk-libs='-L/opt/ActiveTcl-8.6/lib/tcl8.6'
--with-tcltk-includes='-I/opt/ActiveTcl-8.6/include'

Running Python gives the following information

Python 3.8.3 (default, Jul 22 2020, 11:52:15)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> import tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/tkinter/__init__.py", line 36, in <module>
    import _tkinter # If this fails your Python may not be configured
for Tk
ModuleNotFoundError: No module named '_tkinter'
>>>

Obviously there is something wrong with my configure options.

How do that correctly?

Thanks for any help.

K.D.J.


Ned Deily

unread,
Jul 22, 2020, 6:29:00 PM7/22/20
to
On 2020-07-22 06:20, Klaus Jantzen wrote:
> Trying to install Python 3.8.3 with tkinter I run configure with the
> following options
>
> ./configure --enable-optimizations --with-ssl-default-suites=openssl
> --with-openssl=/usr/local --enable-loadable-sqlite-extensions
> --with-pydebug --with-tcltk-libs='-L/opt/ActiveTcl-8.6/lib/tcl8.6'
> --with-tcltk-includes='-I/opt/ActiveTcl-8.6/include'
>
> Running Python gives the following information
[...]
> How do that correctly?

Try --with-tcltk-libs='-L/opt/ActiveTcl-8.6/lib -ltcl8.6 -ltk8.6'


Klaus Jantzen

unread,
Jul 23, 2020, 12:30:43 AM7/23/20
to
Thank you for your suggestion; unfortunately it did not help.

Christian Gollwitzer

unread,
Jul 23, 2020, 1:37:13 PM7/23/20
to
Am 23.07.20 um 06:30 schrieb Klaus Jantzen:
Does the configure process output something when checking for Tcl/Tk?
Does it say "no"? THen you can analyse the config.log file what happened.

In order to compile Tk extensions, you need X11 development headers.
Maybe that is one problem.

Christian

Ned Deily

unread,
Jul 23, 2020, 1:54:57 PM7/23/20
to
On 2020-07-23 00:30, Klaus Jantzen wrote:
> On 7/22/20 11:05 PM, Ned Deily wrote:
>> On 2020-07-22 06:20, Klaus Jantzen wrote:
>>> Trying to install Python 3.8.3 with tkinter I run configure with the
>>> following options
>>>
>>> ./configure --enable-optimizations --with-ssl-default-suites=openssl
>>> --with-openssl=/usr/local --enable-loadable-sqlite-extensions
>>> --with-pydebug --with-tcltk-libs='-L/opt/ActiveTcl-8.6/lib/tcl8.6'
>>> --with-tcltk-includes='-I/opt/ActiveTcl-8.6/include'
>>>
>>> Running Python gives the following information
>> [...]
>>> How do that correctly?
>> Try --with-tcltk-libs='-L/opt/ActiveTcl-8.6/lib -ltcl8.6 -ltk8.6'
>>
>>
> Thank you for your suggestion; unfortunately it did not help.

Without knowing exactly how the /opt/ActiveTcl-8.6 directory is laid
out, we can only guess at what the right options should be. The basic
idea is that there needs to be one or more -I entries that covers the
top-level directory(ies) with Tcl and Tk include files and for the
libraries there needs to be a -L entry for the directory and a -l entry
for the name of the shared library (minus the "lib" prefix), assuming
Tcl and Tk were built with --enable-shared. Usually both libraries are
installed into the same directory, in which case you only need one -L as
above. If they do not have a common parent, you would need to specify
each separately, like -L/libtclparent -l tcl8.6 -L/libtkparent -ltk8.6.

If that doesn't help, you could display the show the contents of the
include and directories here:

ls -l /opt/ActiveTcl-8.6/include /opt/ActiveTcl-8.6/lib

Also exactly what platform are you building on? And, btw, Python 3.8.5
is now current.

Anssi Saari

unread,
Jul 23, 2020, 1:54:57 PM7/23/20
to
Klaus Jantzen <k.d.j...@mailbox.org> writes:

> On 7/22/20 11:05 PM, Ned Deily wrote:
>> On 2020-07-22 06:20, Klaus Jantzen wrote:
>>> Trying to install Python 3.8.3 with tkinter I run configure with the
>>> following options
>>>
>>> ./configure --enable-optimizations --with-ssl-default-suites=openssl
>>> --with-openssl=/usr/local --enable-loadable-sqlite-extensions
>>> --with-pydebug --with-tcltk-libs='-L/opt/ActiveTcl-8.6/lib/tcl8.6'
>>> --with-tcltk-includes='-I/opt/ActiveTcl-8.6/include'
>>>
>>> Running Python gives the following information
>> [...]
>>> How do that correctly?
>> Try --with-tcltk-libs='-L/opt/ActiveTcl-8.6/lib -ltcl8.6 -ltk8.6'
>>
>>
> Thank you for your suggestion; unfortunately it did not help.

Are you sure the libs you need (presumably libtcl8.6.so and libtk8.6.so)
are both in /opt/ActiveTcl-8.6/lib/tcl8.6? Or where are they actually?
Presumably not in /opt/ActiveTcl-8.6/lib since that didn't work.

Could be something else too. You may need to dig into setup.py and the
configure script.

Klaus Jantzen

unread,
Jul 24, 2020, 4:20:03 PM7/24/20
to
On 7/22/20 12:20 PM, Klaus Jantzen wrote:
> Hi,
>
> Trying to install Python 3.8.3 with tkinter I run configure with the
> following options
>
> ./configure --enable-optimizations --with-ssl-default-suites=openssl
> --with-openssl=/usr/local --enable-loadable-sqlite-extensions
> --with-pydebug --with-tcltk-libs='-L/opt/ActiveTcl-8.6/lib/tcl8.6'
> --with-tcltk-includes='-I/opt/ActiveTcl-8.6/include'
>
> Running Python gives the following information
>
> Python 3.8.3 (default, Jul 22 2020, 11:52:15)
> [GCC 8.3.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import sqlite3
> >>> import tkinter
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/local/lib/python3.8/tkinter/__init__.py", line 36, in
> <module>
>     import _tkinter # If this fails your Python may not be configured
> for Tk
> ModuleNotFoundError: No module named '_tkinter'
> >>>
>
> Obviously there is something wrong with my configure options.
>
> How do that correctly?
>
> Thanks for any help.
>
> K.D.J.
>
>
In my post I forgot to mention that I am running PY under Debian Buster.

As suggested by Ned Deily I switched to PY 3.8.5

After some more research in the internet I found that the tcl/tk
libraries have automaticalle been installed during the Buster installation.

For automatically including tkinter during the PY installation one needs
also the 'tk-dev toolkit'.

With that I did not need the options
'--with-tcltk-libs'/'--with-tcltk-includes'

After the installation of PY 3.8.5 I can import tkinter.

Thank you very much for your replies.

K.D.J.



0 new messages