Home > other >  After Centos7 installation TKinter python still couldn't find it
After Centos7 installation TKinter python still couldn't find it

Time:09-25

Has been installed TKinter:
` ` `
[root @ localhost] # RPM - qa | grep tkinter
Tkinter 2.7.5-58. El7. X86_64
` ` `
But still can't find in the python interpreter TKinter:
` ` `
[root @ localhost] # python
Python 2.7.5 (default, 4 Aug 2017, 00:39:18)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
> The import TKinter
Traceback (the most recent call last) :
The File "& lt; Stdin>" , line 1, in
ImportError: No module named TKinter
` ` `

Even more amazing is when performing a GUI script, but there was No hint say [No module named TKinter] (), but has the following error:
` ` `
[root @ localhost] #./GUI. Py
Traceback (the most recent call last) :
The File "./GUI. Py ", line 12, the in & lt; module>
Root=Tkinter. Tk ()
The File "/usr/lib64/python2.7/lib - tk/Tkinter. Py", line 1745, in __init__
Self. Tk=_tkinter. Create (screenName, the baseName className, interactive, wantobjects, useTk, sync, use)
_tkinter. TclError: no display name and no $display environment variable

` ` `

According to the way of the Internet, install Xming, but still has an error:
` ` `
[root @ localhost] #./GUI. Py
Traceback (the most recent call last) :
The File "./GUI. Py ", line 12, the in & lt; module>
Root=Tkinter. Tk ()
The File "/usr/lib64/python2.7/lib - tk/Tkinter. Py", line 1745, in __init__
Self. Tk=_tkinter. Create (screenName, the baseName className, interactive, wantobjects, useTk, sync, use)
_tkinter. TclError: couldn 't connect to display "localhost: 0.0
"` ` `

For the solution!
Thank you all for the first

CodePudding user response:

Python2 seems to be the (k is lowercase)
 import Tkinter 

CodePudding user response:

Is your system server version, there is no window interface, need window version of the interface system

CodePudding user response:

Yum install python3 * with for 3 tkinter

CodePudding user response:

Close test solution: https://blog.csdn.net/rorypeck/article/details/104318676

CodePudding user response:

refer to the second floor oyljerry response:
is your system server version, there is no window interface, need window interface version system

Hello, I am also the server version, that is not line? Or install a window interface is ok?
  • Related