我有2个脚本
但我遇到的问题是将其与我的自动化脚本集成,它会显示
No module named Tkinter.
当我试图通过谷歌搜索和搜索其他网站解决问题时,我发现很少有解决方案
用Tkinter(Python版本< = 3)和Tkinter(python版本> 3)检查 - >情况并非如此
使用安装目录进行软链接
要了解问题,我尝试将所需的安装目录(粗略/不合适的方式)移动到自动化目录 它解决了Tkinter的一个问题,并逐一提出了以下两个问题
a. Traceback (most recent call last):
File "/share/apps/sts/sts_start.py", line 15, in <module>
import Tkinter
File "/share/apps/lib/python/lib-tk/Tkinter.py", line 39, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
b. Traceback (most recent call last):
File "/share/apps/sts/sts_start.py", line 15, in <module>
import Tkinter
File "/share/apps/lib/python/lib-tk/Tkinter.py", line 39, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: libTix.so: cannot open shared object file: No such file or directory
这些问题是预料之中的,因为它会给后续依赖性带来问题。
复制的目录是:
/usr/lib64/python2.6
;
lib-tk
和lib-dynload
/usr/lib64/tcl8.5
进入/share/apps/lib/python
Python版本:
Python 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2
tcl版本:
$ tclsh
% info patchlevel
8.5.7
%
lib-tk安装目录:
/usr/lib64/python/lib-tk
自动化脚本库路径:
/share/apps/lib/python/
$ls
arm_avp common dvtools lib-dynload lib-tk python2.6 site-packages sknobs strega_fe sts-packages tcl8.5
将我的其他环境变量粘贴到下面 -
$ echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/java/latest/bin:/opt/pdsh/bin:/opt/rocks/bin:/opt/rocks/sbin:/opt/gridengine/bin/linux-x64:/share/apps/bin:/home/amcclab/bin
$ echo $PYTHONPATH
/share/apps/lib/python/arm_avp:/share/apps/lib/python/common:/share/apps/lib/python/dvtools:/share/apps/lib/python/lib-dynload:/share/apps/lib/python/lib-tk:/share/apps/lib/python/python2.6:/share/apps/lib/python/site-packages:/share/apps/lib/python/sknobs:/share/apps/lib/python/strega_fe:/share/apps/lib/python/sts-packages:/share/apps/lib/python/tcl8.5
请指导我使用我的脚本处理Tkinter包。