Solved – /usr/bin/python: No module named django

If you get below error, when you tried to check django version using command “python -m django –version” or you are working on some code based on django,

/usr/bin/python: No module named django 

then, the most probable cause of this error is that you have not yet installed django in your workspace. You can solve this error by installing django as,

 $ cd django_container 

Here, “django_container” is our workspace directory where we have all our django code, for you it can be any other directory where your code is.

 $ python3 -m venv env 
 $ source env/bin/activate 
(env)$ pip install django  

Now, if you check django version, you should not see that error and rather see the django version as,

(env) $ python -m django --version
3.0.8

Follow Lynxbee Posts with Google News

Leave a Comment