对于科学应用程序,我需要使用特定版本的Python软件包numpy , scipy和brian2 。 我在我的笔记本电脑上安装了正确的版本,并运行他们的testing套件如下:
>>> import numpy as np >>> import scipy >>> import brian2 >>> np.test() >>> scipy.test() >>> brian2.test()
所有的testing都通过了。
现在我想在我的实验室的计算集群上做同样的事情。 我再次安装了所有正确的版本。 但是,在这个新的环境中,只有numpy和brian2testing通过。 对于scipy ,单个testing失败:
====================================================================== 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时使用该版本?
直接回答你的问题:使用virtualenv在这里解释: https ://stackoverflow.com/questions/5506110/is-it-possible-to-install-another-version-of-python-to-virtualenv
但是,你的结论可能是不正确的,因为numpy,scipy和brian2依赖于系统的许多其他位,而不仅仅是python的版本,而且这些位也可能不同。
你应该做的是使用anaconda python发行版附带的numpy和scipy,因为那些大概已经被testing过了。 brian2不包括在内。 你必须自己testing一下。