2

I am trying to make a very first desktop application using tkinter in pycharm like this.

from tkinter import *

root = Tk()
mLabel = Label(root, text="This is Header")
mLabel.pack
mLabel.mainloop()

But I got an exception saying

ImportError: No module named '_tkinter', please install the python3-tk package

And I tried to install the python3-tk like this

sudo apt-get install python3-tk

But I then got an error about install-info

ronem:::ronem:~$ sudo apt-get install python3-tk
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
libfftw3-single3:i386 libgomp1:i386 libpam-systemd:i386 
libpulsedsp:i386 libtdb1:i386
libwebrtc-audio-processing-0:i386
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
blt tk8.6-blt2.5
Suggested packages:
blt-demo tix python3-tk-dbg
The following NEW packages will be installed:
blt python3-tk tk8.6-blt2.5
0 upgraded, 3 newly installed, 0 to remove and 437 not upgraded.
1 not fully installed or removed.
Need to get 0 B/604 kB of archives.
After this operation, 2,117 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up install-info (6.1.0.dfsg.1-5) ...
/usr/sbin/update-info-dir: 3: /etc/environment: CLASSPATH: not found
dpkg: error processing package install-info (--configure):
subprocess installed post-installation script returned error exit 
status 127
Errors were encountered while processing:
install-info
E: Sub-process /usr/bin/dpkg returned an error code (1)
ronem:::ronem:~$ 

Please guide me through What I am missing

Zanna
  • 69,223
  • 56
  • 216
  • 327
Ram Mandal
  • 123
  • 1
  • 5

1 Answers1

2

Open the terminal and type:

cat /etc/environment  

Check if there is a line in /etc/environment that contains the string CLASSPATH which doesn't belong in /etc/environment. You should comment out everything from /etc/environment except for the first line (the setting of PATH which starts with PATH=) by preceding each line to be commented out by a # character. Open the /etc/environment file for editing in nano text editor with the following command:

sudo nano /etc/environment  

Nano editor keyboard shortcuts
Use the keyboard combination Ctrl + O and after that press Enter to save the file to its current location.
Use the keyboard combination Ctrl + X to exit nano.

karel
  • 110,292
  • 102
  • 269
  • 299
  • I get this while using cat etc/environment ronem:::ronem:~$ cat /etc/environment PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/tomcat/bin" CATALINA_HOME=/opt/tomcat CLASSPATH = /opt/tomcat/lib/servlet-api.jar:/opt/tomcat/lib/jsp-api.jar ronem:::ronem:~$ – Ram Mandal Jan 31 '18 at 08:59
  • 1
    Holly molly . You rocks Friend . commenting the CLASSATH line solved this issue. Thanks a ton – Ram Mandal Jan 31 '18 at 09:04