使用 Python 2.7.15 版安装 后:pysparse
$ pyenv local 2.7.15
$ pip install pysparse==1.2-dev213
我尝试测试安装,如pysparse
主页所示。但是当我运行测试时
testSuperlu.py
,我收到以下错误:
Traceback (most recent call last):
File "testSuperlu.py", line 3, in <module>
from pysparse.tools import poisson
File "/home/hakon/.pyenv/versions/2.7.15/lib/python2.7/site-packages/pysparse/__init__.py", line 6, in <module>
from numpy._import_tools import PackageLoader
ImportError: No module named _import_tools
好像numpy._import_tools
不见了。我使用
的是numpy
1.16.0 版。
编辑:
在下面的答案中遵循@wd15 的建议后,即安装不同版本的pyparse
and numpy
:
$ pip install pysparse==1.1.1-dev
$ pip install numpy==1.15.1
然后再次运行测试程序testSuperlu.py
:
$ python testSuperlu.py
ImportError: No module named _multiarray_umath
Traceback (most recent call last):
File "testSuperlu.py", line 3, in <module>
from pysparse.tools import poisson
File "/home/hakon/.pyenv/versions/2.7.15/lib/python2.7/site-packages/pysparse/__init__.py", line 9, in <module>
from sparse import spmatrix
File "/home/hakon/.pyenv/versions/2.7.15/lib/python2.7/site-packages/pysparse/sparse/__init__.py", line 6, in <module>
from pysparseMatrix import *
File "/home/hakon/.pyenv/versions/2.7.15/lib/python2.7/site-packages/pysparse/sparse/pysparseMatrix.py", line 57, in <module>
from pysparse.sparse import spmatrix
ImportError: numpy.core.multiarray failed to import