0

我正在尝试在我的 python 2.7.3 上安装 QSTK。(在 Windows 10 上)。在安装过程中,似乎没有问题,我也没有遇到任何错误。但是,当我运行 validation.py ( here ) 来检查时,似乎无法导入 QSTK.qstkstudu。这是我在运行validation.py时遇到的错误:

QSTK 已安装并可导入

[...]

QSTK.qstkutil 已安装,可以导入

__call__ 中的文件“C:\Python27\lib\site.py”,第 372 行

引发系统退出(代码)

SystemExit:错误:无法导入 QSTK.qstkstudy。

有谁知道我该怎么办?

4

1 回答 1

1

Validation.py产生错误 的行是:

import QSTK.qstkstudy.EventProfiler  

如果你直接在python中尝试,你可以看到缺少什么。就我而言,它是 tkinter。

>>> import QSTK.qstkstudy.EventProfiler  
Traceback (most recent call last):  
  File "<stdin>", line 1, in <module>  
  File "/usr/local/lib/python2.7/dist-packages/QSTK-0.2.8-py2.7.egg/QSTK/qstkstudy/EventProfiler.py", line 16, in <module>  
    import matplotlib.pyplot as plt  
  File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 114, in <module>  
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()  
  File "/usr/lib/python2.7/dist-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup  
globals(),locals(),[backend_name],0)  
  File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 6, in <module>  
from matplotlib.externals.six.moves import tkinter as Tk  
  File "/usr/lib/python2.7/dist-packages/matplotlib/externals/six.py", line 199, in load_module  
mod = mod._resolve()  
  File "/usr/lib/python2.7/dist-packages/matplotlib/externals/six.py", line 113, in _resolve  
return _import_module(self.mod)  
  File "/usr/lib/python2.7/dist-packages/matplotlib/externals/six.py", line 80, in _import_module  
__import__(name)  
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 42, in <module>  
raise ImportError, str(msg) + ', please install the python-tk package'  
ImportError: No module named _tkinter, please install the python-tk package 

我在Linux上,所以我做到了

sudo apt-get python-tk  

谷歌如何在 Windows 中安装 python tkinter。

祝你好运

于 2017-01-10T17:10:54.567 回答