[Python] ModuleNotFoundError or ImportError: No module named <something>

Discussão em 'Python' iniciado por Stack, Setembro 2, 2025.

  1. Stack

    Stack Membro Participativo

    The following is my directory structure.

    ankur
    ├── ankur1
    │ ├── __init__.py
    │ └── util.py
    ├── ankur2
    │ └── main.py
    └── __init__.py


    In main.py, when importing the util submodule:

    import ankur.ankur1.util


    I get the following error (Python 2.x error message)

    ImportError: No module named ankur.ankur1.util


    Or (Python 3.x error message)

    ModuleNotFoundError: No module named 'ankur'

    Continue reading...

Compartilhe esta Página