无法将matplotlib.pyplot导入为plt

时间:2017-06-04 10:34:03

标签: python matplotlib

    >>> import matplotlib.pyplot as plt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\python27\lib\site-packages\matplotlib\pyplot.py", line 115, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "C:\python27\lib\site-packages\matplotlib\backends\__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "C:\python27\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 6, in <module>
    from six.moves import tkinter as Tk
  File "C:\python27\lib\site-packages\six.py", line 203, in load_module
    mod = mod._resolve()
  File "C:\python27\lib\site-packages\six.py", line 115, in _resolve
    return _import_module(self.mod)
  File "C:\python27\lib\site-packages\six.py", line 82, in _import_module
    __import__(name)
  File "C:\python27\lib\lib-tk\Tkinter.py", line 38, in <module>
    import FixTk
  File "C:\python27\lib\lib-tk\FixTk.py", line 68, in <module>
    import _tkinter
ImportError: DLL load failed: %1 is not a valid Win32 application.

大家好,当我想要导入matplotlib.pyplot作为plt时,我遇到了问题。 但是我通过使用pip install matplotlib成功安装了matplotlib,我能够导入matplotlib但无法导入matplotlib.pyplot 你们有什么想法吗? 你当

1 个答案:

答案 0 :(得分:0)

  1. 安装64位Python 2。
  2. 从cmd提示符下运行pip install matplotlib