简体   繁体   中英

Cannot import behave.given in pydev for django

I have a Django project for which I am incorporating BDD using behave. I am using PyDev as my development environment. 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'.

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

Have you set the interpreter of PyDev?

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). – Thanks to Fabio Zadrozny

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