Python Forum
mx19.2 python & tkinter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
mx19.2 python & tkinter
#1
i have python installed on mx 19.2

from xterm

bill@mx:~
$ python -V
Python 2.7.16
bill@mx:~
$ python3 -V
Python 3.7.3
bill@mx:~

bill@mx:~
$ whereis python
python: /usr/bin/python2.7 /usr/bin/python3.7 /usr/bin/python3.7m /usr/bin/python /usr/lib/python2.7 /usr/lib/python3.7 /usr/lib/python2.6 /etc/python2.7 /etc/python3.7 /etc/python /usr/local/lib/python2.7 /usr/local/lib/python3.7 /usr/include/python2.7 /usr/include/python3.7m /usr/share/python /usr/share/man/man1/python.1.gz
bill@mx:~
$

bill@mx:~
$ sudo apt install python3.7 python3-tk
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-tk is already the newest version (3.7.3-1).
python3.7 is already the newest version (3.7.3-2+deb10u2).
python3.7 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
bill@mx:~

if i run a script dloaded from the net in geaney i get

import tkinter as tk
ImportError: No module named tkinter

help please
Reply
#2
re: import tkinter as tkinter ImportError: No module named tkinter



apt list | grep python3-tk

and then



python3 -m tkinter


ie

bill@mx:~
$ apt list | grep python3-tk

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

python3-tk/oldstable,now 3.5.3-1 amd64 [installed]
python3-tk-dbg/oldstable 3.5.3-1 amd64
python3-tksnack/oldstable,oldstable 2.2.10.20090623-dfsg-6 all
bill@mx:~
$ python3 -m tkinter
bill@mx:~


why does this show tkinter to be installed yet a script that includes import tkinter etc fails?

thanks
Reply
#3
You have multiple versions of python3

Look at the folder

/usr/lib/python3.7/

is there a tkinter folder ?
Reply
#4
thanks Axel

i have both python 2.7 and 3.5 installed
user/lib3.5 includes tkinter but not usr/lib/python2.5

can i uninstall 2.5 to fix the problem?

thanks
Reply
#5
No, I mean python3 only.

What is the output of

ls /usr/lib/ | grep python
Reply
#6
thanks for the quick reply

as requested

bill@mx:~
$ ls /usr/lib/ | grep python
libpyglib-2.0-python2.7.so.0
libpyglib-2.0-python2.7.so.0.0.0
python2.6
python2.7
python3
python3.5
bill@mx:~

thanks again
Reply
#7
ok ive managed to get 1 script dloaded from the web to run by opening a terminal and entering

python3 /path-to-file/file-name.py

but this does not work with other examples
plus i am unable to run same script from geany/idle/thonny/glade etc
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020