简体   繁体   English

当我尝试运行鼻子测试时出现许多python模块错误

[英]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: 为什么当我运行nosetests我会陷入有关python模块的一些错误,例如:

...
    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 . 我不确定是有关依赖关系的问题,还是在运行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 附加:实际上,对于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)

but for line 8, 9, 10 no any errors but error was occured on line 11. 但是对于第8、9、10行,没有任何错误,但第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 放在〜/ .profile上

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我从virtualenv运行nosetests时,为什么会出现“无效的命令nosetests”错误? - Why do I get the error “Invalid command nosetests” when I run nosetests from my virtualenv? 当我在我的python代码中使用argparse时,无法运行nosetests - Can not run nosetests when i use argparse in my python code 当我尝试运行该程序时,出现以下错误:文件“ python”,第33行,在 <module> NameError:未定义全局名称“ hp” - When i try to run this program i get this error: File “python”, line 33, in <module> NameError: global name 'hp' is not defined 当我尝试在 python 上安装模块时,错误不断出现 - Error keeps on showing up when i try to install a module on python 当我尝试运行一个py文件时出现Python错误 - Python error when I try to run one py file 超出时间限制错误 - 当我尝试运行 Python 3 代码时 - Time limit exceeded Error - When I try to run Python 3 code zsh:当我尝试在 venv 中运行应用程序时,中止 python 错误 - zsh: abort python error when I try to run the app in venv 我正在尝试运行现有代码,但是当我尝试运行代码时,错误显示“没有名为 fetch 的模块” - I am trying to run and existing code but when I try to run the code the error shows “No module named fetch” Python Nosetests导入错误 - Python Nosetests Import Error 当我尝试优化这些代码行时出现 Python 错误 - Python Error's when I try to optimize those lines of code
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM