[英]Many python's module error when i try to run nosetests
Why when i run nosetests
i will stuck in several errors about python's module for example: 为什么当我运行
nosetests
我会陷入有关python模块的一些错误,例如:
...
output = np.polynomial.legendre.leggauss(deg)
AttributeError: 'module' object has no attribute 'leggauss'
----------------------------------------------------------------------
Ran 1 test in 0.954s
FAILED (errors=1)
I'm not sure is it about dependency problem or i miss some setup step before i run nosetests
. 我不确定是有关依赖关系的问题,还是在运行
nosetests
之前错过了一些设置步骤。
But anyway for sure that i have no problem when i run my main program, it work well. 但是无论如何,可以肯定的是,当我运行主程序时我没有问题,它运行良好。 but for my test file it stuck in error.
但是对于我的测试文件,它卡住了错误。
Addtional: In actually, for numpy there are 3 lines of calling numpy before output = np.polynomial.legendre.leggauss(deg)
line 附加:实际上,对于numpy,在
output = np.polynomial.legendre.leggauss(deg)
行之前,有3行调用numpy
8 A = np.zeros(shape=(deg, deg), dtype=np.complex)
9 R = np.zeros(shape=(deg), dtype=np.complex)
10 J = np.zeros(shape=(deg))
11 output = np.polynomial.legendre.leggauss(deg)
but for line 8, 9, 10 no any errors but error was occured on line 11. 但是对于第8、9、10行,没有任何错误,但第11行发生了错误。
OK, everything fine. 好,一切都很好。 I just forgot to export path.
我只是忘了导出路径。
export PYTHONPATH=/Library/Python/2.7/site-packages:/opt/local/lib/python2.7
put it on ~/.profile 放在〜/ .profile上
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.