对于科学应用程序,我需要使用特定版本的packages numpy
、scipy
和brian2
。我已经在我的笔记本电脑上安装了正确的版本,并按如下方式运行了它们的测试套件:
>>> import numpy as np
>>> import scipy
>>> import brian2
>>> np.test()
>>> scipy.test()
>>> brian2.test()
所有的测试都通过了。
现在,我想在实验室的计算机集群上做同样的事情。我再次安装了所有正确的版本。但是,在这个新环境中,只有numpy
和brian2
测试通过。对于scipy
,一个测试失败:
======================================================================
FAIL: test_decomp_update.TestQRdelete_f.test_delete_last_p_col
----------------------------------------------------------------------
Traceback (most recent call last): File
"/usr/local/anaconda/lib/python2.7/site-packages/nose/case.py", line
197, in runTest
self.test(*self.arg) File "/home/despo/dbliss/lib/python2.7/site-packages/scipy/linalg/tests/test_decomp_update.py",
line 328, in test_delete_last_p_col
assert_unitary(q1) File "/home/despo/dbliss/lib/python2.7/site-packages/scipy/linalg/tests/test_decomp_update.py",
line 21, in assert_unitary
assert_allclose(aTa, np.eye(a.shape[1]), rtol=rtol, atol=atol) File
"/home/despo/dbliss/.local/lib/python2.7/site-packages/numpy/testing/utils.py",
line 1297, in assert_allclose
verbose=verbose, header=header) File "/home/despo/dbliss/.local/lib/python2.7/site-packages/numpy/testing/utils.py",
line 665, in assert_array_compare
raise AssertionError(msg) AssertionError: Not equal to tolerance rtol=0.0001, atol=2.38419e-07
(mismatch 100.0%) x: array([[ 9.999999e-01, 1.746230e-08,
-1.490116e-08, 1.490116e-08,
-6.146729e-08, -6.332994e-08, 3.352761e-08, 7.450581e-08,
3.352761e-08, 2.142042e-08, -4.097819e-08, 4.656613e-08],... y: array([[ 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0.],...
----------------------------------------------------------------------
Ran 18599 tests in 253.381s
FAILED (KNOWNFAIL=97, SKIP=1165, failures=1)
从表面上看,我的计算集群和我的笔记本电脑之间唯一相关的区别是它们运行的Python版本。我的笔记本电脑的版本为2.7.6,而集群的版本为2.7.10。
我的问题是,如何在集群上本地安装2.7.6版本(即我的帐户的本地版本),然后在打开IPython时使用该版本?
发布于 2015-10-07 13:47:30
直接回答您的问题:使用virtualenv,如下面所解释的:https://stackoverflow.com/questions/5506110/is-it-possible-to-install-another-version-of-python-to-virtualenv
但是,您的结论可能是不正确的,因为numpy、and和brian2依赖于系统的许多其他位元,而不仅仅是python的版本,而且这些位元可能也不同。
您应该做的是使用anaconda python发行版附带的numpy和scipy,这可能已经过测试。brian2不包括在内。你得自己测试一下。
https://serverfault.com/questions/727430
复制相似问题