簡體   English   中英

當我嘗試運行鼻子測試時出現許多python模塊錯誤

[英]Many python's module error when i try to run nosetests

為什么當我運行nosetests我會陷入有關python模塊的一些錯誤,例如:

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

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

FAILED (errors=1)

我不確定是有關依賴關系的問題,還是在運行nosetests之前錯過了一些設置步驟。

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

附加:實際上,對於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)

但是對於第8、9、10行,沒有任何錯誤,但第11行發生了錯誤。

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

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

放在〜/ .profile上

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM