ImportError: No module named 'tkinter' Windows解决办法

Python写线性回归算法,导入了几个科学计算库,运行时报这样的错:

"D:\Program Files\Python 3.5\python.exe" "D:/exercise/AI/testAI/linear regression/ex1_1.py"
Traceback (most recent call last):
  File "D:/exercise/AI/testAI/linear regression/ex1_1.py", line 3, in
    import matplotlib.pyplot as plt
  File "D:\Program Files\Python 3.5\lib\site-packages\matplotlib\pyplot.py", line 115, in
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "D:\Program Files\Python 3.5\lib\site-packages\matplotlib\backends\__init__.py", line 62, in pylab_setup
    [backend_name], 0)
  File "D:\Program Files\Python 3.5\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 4, in
    from . import tkagg  # Paint image to Tk photo blitter extension.
  File "D:\Program Files\Python 3.5\lib\site-packages\matplotlib\backends\tkagg.py", line 5, in
    from six.moves import tkinter as Tk
  File "D:\Program Files\Python 3.5\lib\site-packages\six.py", line 92, in __get__
    result = self._resolve()
  File "D:\Program Files\Python 3.5\lib\site-packages\six.py", line 115, in _resolve
    return _import_module(self.mod)
  File "D:\Program Files\Python 3.5\lib\site-packages\six.py", line 82, in _import_module
    __import__(name)

ImportError: No module named 'tkinter'


网上折腾了半天,想找到tkinter库,都没找到合适的答案。

然后想是不是Python版本太低了,又下了其他高版本,安装时发现了这一个选项



重新安装一下,然后OK了~

你可能感兴趣的:(人工智能)