close

[Solved] import : ‘No module named’ *does* exist

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error import : ‘No module named’ does exist 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 import : ‘No module named’ does exist Error Occurs?

Today I get the following error import : ‘No module named’ does exist in python.

How To Solve import : ‘No module named’ does exist Error ?

  1. How To Solve import : 'No module named' does exist Error ?

    To Solve import : 'No module named' does exist Error My usual trick is to simply print sys.path in the actual context where the import problem happens.

  2. import : 'No module named' does exist

    To Solve import : 'No module named' does exist Error My usual trick is to simply print sys.path in the actual context where the import problem happens.

Solution 1

My usual trick is to simply print sys.path in the actual context where the import problem happens. In your case it’d seem that the place for the print is in /home/hughdbrown/.local/bin/pserve . Then check dirs & files in the places that path shows..

You do that by first having:

import sys

and in python 2 with print expression:

print sys.path

or in python 3 with the print function:

print(sys.path)

Solution 2

I set the PYTHONPATH to '.' and that solved it for me.

export PYTHONPATH='.'

For a one-liner you could as easily do:

PYTHONPATH='.' your_python_script

These commands are expected to be run in a terminal

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