导入matplotlib时偶尔出错

2024-04-20 10:48:28 发布

您现在位置:Python中文网/ 问答频道 /正文

在新创建的终端中,我可以import matplotlib没有错误。然而,在终端工作一段时间后,会发生以下情况:

Python 2.7.5 (default, Mar  9 2014, 22:15:05) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
Usage: example.py torrentfile.torrent
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py", line 134, in <module>
    from matplotlib.rcsetup import (defaultParams,
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/rcsetup.py", line 19, in <module>
    from matplotlib.colors import is_color_like
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/colors.py", line 54, in <module>
    import matplotlib.cbook as cbook
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/cbook.py", line 15, in <module>
    import new
  File "new.py", line 12, in <module>
    with open(sys.argv[1], 'rb') as fh:
IndexError: list index out of range

怎么了?你知道吗


Tags: inpyimportextrasmatplotlibliblinelibrary