Failed to enable GUI event loop integration for 'tk'
Traceback (most recent call last):
File "/opt/pycharm-2018.2.8/helpers/pydev/_pydev_bundle/pydev_console_utils.py", line 663, in do_enable_gui
enable_gui(guiname)
File "/opt/pycharm-2018.2.8/helpers/pydev/pydev_ipython/inputhook.py", line 536, in enable_gui
return gui_hook(app)
File "/opt/pycharm-2018.2.8/helpers/pydev/pydev_ipython/inputhook.py", line 285, in enable_tk
app = _TK.Tk()
File "/usr/lib/python3.6/tkinter/__init__.py", line 2023, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: Can't find a usable tk.tcl in the following directories:
/usr/local/lib/tcl8.6/tk8.6 /usr/local/lib/tk8.6 /home/lidada/.virtualenvs/lidada_01/lib/tk8.6 /home/lidada/.virtualenvs/lidada_01/lib/tk8.6 /home/lidada/.virtualenvs/lib/tk8.6 /home/lidada/.virtualenvs/lidada_01/library
/usr/local/lib/tk8.6/tk.tcl: version conflict for package "Tk": have 8.6.8, need exactly 8.6.11
version conflict for package "Tk": have 8.6.8, need exactly 8.6.11
while executing
"package require -exact Tk 8.6.11"
(file "/usr/local/lib/tk8.6/tk.tcl" line 14)
invoked from within
"source /usr/local/lib/tk8.6/tk.tcl"
("uplevel" body line 1)
invoked from within
"uplevel #0 [list source $file]"
This probably means that tk wasn't installed properly.
问题所在
Can’t find a usable tk.tcl in the following directories:
version conflict for package “Tk”: have 8.6.8, need exactly 8.6.11
分析:
/usr/local/lib/tcl8.6/tk8.6 /usr/local/lib/tk8.6 /home/lidada/.virtualenvs/lidada_01/lib/tk8.6 /home/lidada/.virtualenvs/lidada_01/lib/tk8.6 /home/lidada/.virtualenvs/lib/tk8.6 /home/lidada/.virtualenvs/lidada_01/library
这是它查找的目录:
cd /usr/local/lib/tcl8.6/tk8.6 /usr/local/lib/tk8.6
进入tk.tcl 发现第14行要求为8.6.11 将此处改为8.6.8
同时将tcl8.6 中的 init.tcl 中,因为
先有tcl,它是一种语言
然后是tk,它是tcl语言下的针对图形界面编程的一个库/包/框架,随你怎么叫,好理解就行
然后是tkinter,它是Python对tk的一个封装(前端,frontend),可以认为是Python图形界面编程的标准库
将此改为 8.6.8
如果linux中没有tck/tk 安装教程如该链接:
https://blog.csdn.net/dujie1219/article/details/110235766
本文参考了 http://www.jyguagua.com/?p=589