我正在尝试在OpenSUSE 11.4上安装matplotlib
使用pip
(成功)
然后清除matplotlib
(成功)
然后当我跑
import matplotlib
matplotlib.test()
我得到了
RuntimeError: module compiled against API version 6 but this version of numpy is 4
RuntimeError: module compiled against API version 6 but this version of numpy is 4
...
...
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEERuntimeError: module compiled against API version 6 but this version of numpy is 4
ES.............
然后是一堆错误,比如
======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'test_agg')
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/nose/loader.py", line 400, in loadTestsFromName
module = resolve_name(addr.module)
File "/usr/local/lib/python2.7/site-packages/nose/util.py", line 321, in resolve_name
obj = getattr(obj, part)
AttributeError: 'module' object has no attribute 'test_agg'
======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'test_arrow_patches')
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/nose/loader.py", line 400, in loadTestsFromName
module = resolve_name(addr.module)
File "/usr/local/lib/python2.7/site-packages/nose/util.py", line 321, in resolve_name
obj = getattr(obj, part)
AttributeError: 'module' object has no attribute 'test_arrow_patches'
最后
======================================================================
ERROR: test suite for <module 'matplotlib.tests' from '/usr/local/lib64/python2.7/site-packages/matplotlib/tests/__init__.pyc'>
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/nose/suite.py", line 208, in run
self.setUp()
File "/usr/local/lib/python2.7/site-packages/nose/suite.py", line 291, in setUp
self.setupContext(ancestor)
File "/usr/local/lib/python2.7/site-packages/nose/suite.py", line 314, in setupContext
try_run(context, names)
File "/usr/local/lib/python2.7/site-packages/nose/util.py", line 469, in try_run
return func()
File "/usr/local/lib64/python2.7/site-packages/matplotlib/tests/__init__.py", line 28, in setup
from matplotlib.backends import backend_agg, backend_pdf, backend_svg
File "/usr/local/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 27, in <module>
from matplotlib.backend_bases import RendererBase,\
File "/usr/local/lib64/python2.7/site-packages/matplotlib/backend_bases.py", line 50, in <module>
import matplotlib.textpath as textpath
File "/usr/local/lib64/python2.7/site-packages/matplotlib/textpath.py", line 14, in <module>
from matplotlib.mathtext import MathTextParser
File "/usr/local/lib64/python2.7/site-packages/matplotlib/mathtext.py", line 62, in <module>
import matplotlib._png as _png
ImportError: numpy.core.multiarray failed to import
----------------------------------------------------------------------
Ran 50 tests in 9.038s
FAILED (SKIP=1, errors=37)
False
答案 0 :(得分:0)
原来有人使用numpy
而不是zypper
安装pip
(v 1.5),默认numpy
版本为1.5而不是1.8(如由pip
安装。不知不觉,他们安装到
/usr/local/lib64/python2.7/site-packages/numpy # PIP
和
/usr/lib64/python2.7/site-packages/numpy # Zypper