Numpy test()完成,但出现错误 [英] Numpy test() finished with errors
问题描述
我已经通过sudo apt-get install python-numpy
安装了python 2.7.3,numpy 1.6.1.我通过numpy.test()
从numpy运行test()
,我得到了:
on ubuntu 12.04 x32 I have installed python 2.7.3, numpy 1.6.1 via sudo apt-get install python-numpy
. I run the test()
from numpy via numpy.test()
and I get:
失败:test_pareto(test_random.TestRandomDist)
回溯(最近通话最近): 在test_pareto中的第313行,文件"/usr/lib/python2.7/dist-packages/numpy/random/tests/test_random.py" np.testing.assert_array_almost_equal(实际,期望,十进制= 15) 在assert_array_almost_equal中的文件"/usr/lib/python2.7/dist-packages/numpy/testing/utils.py",第800行 header =('数组几乎不等于%d个小数'%个十进制)) 在assert_array_compare中的文件"/usr/lib/python2.7/dist-packages/numpy/testing/utils.py",第636行 引发AssertionError(msg) AssertionError: 数组几乎不等于15个小数位
FAIL: test_pareto (test_random.TestRandomDist)
Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/numpy/random/tests/test_random.py", line 313, in test_pareto np.testing.assert_array_almost_equal(actual, desired, decimal=15) File "/usr/lib/python2.7/dist-packages/numpy/testing/utils.py", line 800, in assert_array_almost_equal header=('Arrays are not almost equal to %d decimals' % decimal)) File "/usr/lib/python2.7/dist-packages/numpy/testing/utils.py", line 636, in assert_array_compare raise AssertionError(msg) AssertionError: Arrays are not almost equal to 15 decimals
(不匹配16.6666666667%) x:数组([[2.46852460e + 03,1.41286881e + 03], [5.28287797e + 07,6.57720981e + 07], [1.40840323e + 02,1.98390255e + 05]]) y:数组([[2.46852460e + 03,1.41286881e + 03], [5.28287797e + 07,6.57720981e + 07], [1.40840323e + 02,1.98390255e + 05]])
(mismatch 16.6666666667%) x: array([[ 2.46852460e+03, 1.41286881e+03], [ 5.28287797e+07, 6.57720981e+07], [ 1.40840323e+02, 1.98390255e+05]]) y: array([[ 2.46852460e+03, 1.41286881e+03], [ 5.28287797e+07, 6.57720981e+07], [ 1.40840323e+02, 1.98390255e+05]])
在17.483秒内运行了3169次测试
Ran 3169 tests in 17.483s
失败(KNOWNFAIL = 3,SKIP = 4,失败= 1)
FAILED (KNOWNFAIL=3, SKIP=4, failures=1)
我该怎么办?我错过了依赖吗?
What should I do? did I miss a dependency or so?
谢谢.
推荐答案
在尝试重做内容时,为将来的我提供的注意事项:
Notes for the future me, when trying to redo the stuff:
- 使用
numpy
/scipy
有一些先决条件:g++
gfortran
blas
atlas
lapack
. - 编译numpy/scipy源似乎更好,也很耗时.点安装即可做到这一点.
- there are some prerequisites for working with
numpy
/scipy
:g++
gfortran
blas
atlas
lapack
. - it seems to be better -- and time consuming -- to compile the numpy/scipy sources. pip install does this.
命令是:
sudo apt-get install g ++ gfortran liblapack-dev libopenblas-dev python-dev python-pip
sudo apt-get install g++ gfortran liblapack-dev libopenblas-dev python-dev python-pip
sudo pip安装鼻孔
sudo pip install nose
sudo pip install numpy
sudo pip install numpy
python -c"import numpy; numpy.test()"
python -c "import numpy; numpy.test()"
对于scipy库,以下工作有效:
For the scipy library the following worked:
sudo pip install scipy
sudo pip install scipy
python -c"import scipy; scipy.test()"
python -c "import scipy; scipy.test()"
这篇关于Numpy test()完成,但出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!