导入matplotlib时出错

时间:2016-06-18 19:10:25

标签: python numpy matplotlib importerror python-unittest

当我尝试在python 2.7中导入matplotlib时,我收到以下错误:

➜  ~ python
Python 2.7.10 (default, Jul 14 2015, 19:46:27) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
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 156, in <module>
    from matplotlib.cbook import is_string_like
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/cbook.py", line 28, in <module>
    import numpy as np
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/__init__.py", line 153, in <module>
    from . import add_newdocs
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/__init__.py", line 46, in <module>
    from numpy.testing import Tester
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/testing/__init__.py", line 10, in <module>
    from unittest import TestCase
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/__init__.py", line 59, in <module>
    from .case import (TestCase, FunctionTestCase, SkipTest, skip, skipIf,
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py", line 13, in <module>
    from .util import (
ImportError: cannot import name _count_diff_all_purpose
>>> 

这似乎与numpy和unittest模块有关。如何解决此错误?

0 个答案:

没有答案