close

[Solved] Python – ModuleNotFoundError: No module named

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Python – ModuleNotFoundError: No module named in Python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Python – ModuleNotFoundError: No module named Error Occurs?

Today I get the following error Python – ModuleNotFoundError: No module named in Python.

How To Solve Python – ModuleNotFoundError: No module named Error ?

  1. How To Solve Python – ModuleNotFoundError: No module named Error ?

    To Solve Python – ModuleNotFoundError: No module named Error Setting PYTHONPATH can also help with this problem. Here is how it can be done on Windows
    set PYTHONPATH=.

Solution 1

Setting PYTHONPATH can also help with this problem.

Here is how it can be done on Windows

set PYTHONPATH=.

Solution 2

You can simply add following file to your tests directory, and then python will run it before the tests

__init__.py file

import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))

Solution 3

Set PYTHONPATH environment variable in root project directory.

Considering UNIX-like:

export PYTHONPATH=.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment