简体   繁体   中英

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:

...
    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 .

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

  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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM