简体   繁体   English

无法导入pydev中为Django提供的行为

[英]Cannot import behave.given in pydev for django

I have a Django project for which I am incorporating BDD using behave. 我有一个Django项目,为此我将使用行为整合BDD。 I am using PyDev as my development environment. 我正在使用PyDev作为开发环境。 I have installed behave_dhango and behave using pip within the conda environment and I can see that the folders have been created in the site-packages folder within the right conda 'env'. 我已经安装了behavior_dhango并在conda环境中使用pip进行操作,并且可以看到文件夹已在正确的conda'env'的site-packages文件夹中创建。

For some reason, I am not able to import the 'given, when and then' decorators from behave as thus: 由于某种原因,我无法从行为如下导入“给定,何时,然后”装饰器:

    from behave import given, when, then

It says "Unresolved import given... when... and then..." 它说:“何时……然后……给出了未解决的进口”。

I have not found any naming conflicts and cannot understand the reason why the above code isn't working. 我没有发现任何命名冲突,也无法理解上述代码无法正常工作的原因。

Python 2.7 Django 1.11 behave 1.2.6 Python 2.7 Django 1.11的行为1.2.6

Have you set the interpreter of PyDev? 您是否设置了PyDev的翻译?

http://www.pydev.org/manual_101_interpreter.html http://www.pydev.org/manual_101_interpreter.html

If you add behave to the forced builtins, does it work? 如果将行为添加到强制内建函数中,是否起作用? (see pydev.org/… for details on how to do that). (有关如何执行此操作的详细信息,请参见pydev.org/…)。 – Thanks to Fabio Zadrozny –感谢Fabio Zadrozny

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

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