2014-06-20 32 views
0

爲什麼當我運行nosetests我會停留在幾個錯誤了Python的,例如模塊:許多Python的模塊錯誤運行nosetests

... 
    output = np.polynomial.legendre.leggauss(deg) 
AttributeError: 'module' object has no attribute 'leggauss' 

---------------------------------------------------------------------- 
Ran 1 test in 0.954s 

FAILED (errors=1) 

我不知道是關於什麼的依賴問題,或者我錯過一些設置步驟之前我運行nosetests

但無論如何肯定我沒有問題,當我運行我的主程序時,它工作得很好。但對於我的測試文件,它卡住了錯誤。

Addtional:在實際上,對於numpy的有主叫numpy的前output = np.polynomial.legendre.leggauss(deg)

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) 

但對於線8,9,10沒有任何錯誤,但錯誤被髮生在線路的3線11

回答

1

好吧,一切都很好。我只是忘記了導出路徑。

export PYTHONPATH=/Library/Python/2.7/site-packages:/opt/local/lib/python2.7 

把它放在〜/ .profile文件