1

我正在尝试使用matplotlib.pyplot和子进程制作图表,但出现以下错误:

Traceback (most recent call last):
    File "subprocess.py", line 2, in <module>
        import matplotlib.pyplot as plt
    File "/usr/lib/pymodules/python2.7/matplotlib/__init__.py", line 105, in <module>
        import os, re, shutil, subprocess, sys, warnings
    File "/home/igor/Documentos/subprocess.py", line 2, in <module>
        import matplotlib.pyplot as plt
    File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 20, in <module>
        from matplotlib import _pylab_helpers, interactive
ImportError: cannot import name interactive

错误sys.excepthook

Traceback (most recent call last):
    File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 66, in apport_excepthook
        from apport.fileutils import likely_packaged, get_recent_crashes
    File "/usr/lib/python2.7/dist-packages/apport/__init__.py", line 1, in <module>
        from apport.report import Report
    File "/usr/lib/python2.7/dist-packages/apport/report.py", line 12, in <module>
        import subprocess, tempfile, os.path, urllib, re, pwd, grp, os
    File "/home/igor/Documentos/subprocess.py", line 2, in <module>
        import matplotlib.pyplot as plt
    File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 20, in <module>
        from matplotlib import _pylab_helpers, interactive
ImportError: cannot import name _pylab_helpers

如果我尝试不使用子进程来绘制图表(只是将 2 个数组绘制为轴),我不会遇到这个问题。

有人能帮我吗?

4

0 回答 0