ImportError: No module named - Python

后端 未结 6 1629
闹比i
闹比i 2020-11-28 04:52

I have a python application with the following directory structure:

src
 |
 +---- main
 |
 +---- util
 |
 +---- gen_py
         |
         +---- lib
<         


        
6条回答
  •  醉梦人生
    2020-11-28 05:28

    from ..gen_py.lib import MyService
    

    or

    from main.gen_py.lib import MyService
    

    Make sure you have a (at least empty) __init__.py file on each directory.

提交回复
热议问题