I have a project with the following structure
-project
--src
--test
when i run pytest inside project folder from python2 ( python2 -m pytest
), it works fine, however, with python 3 ( python3 -m pytest
), i have an error in the test files as it cant find the imports in the src folder
I have an __init__.py
in both folders
Is there any reason why it should be different in python2 and python3? How could i make it work in python3?
Thanks
您尚未提供有关确切导入错误的详细信息,但可能您正在使用相对导入,在Python 2和3中,相对导入的行为有所不同。如果是这种情况,请尝试使用绝对导入。
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.