ModuleNotFoundError: No module named 'django' after adding specific path into the global .bashrc file

I am getting this weird messages: enter image description here

it says Couldn't import Django when I type this on command line: python3 startapp engine

I have found out that the Django is located in: /home/h/hswong00/miniconda3/lib/python3.9/site-packages

enter image description here

But the way I found out where it is located is by loading python, not python 3. But I need python3, not python for my work. So when I typed:

in linux terminal: python

after loading python in terminal: import sys

                             : sys.path

that's how I found out where Django is installed.

So I googled for some solution here, and I found that I could tried edit the bashrc file by adding: export PYTHONPATH="${PYTHONPATH}:/home/h/hswong00/miniconda3/lib/python3.9/site-packages"

to the .bashrc file. But still when I type: python3 startapp engine

it still produces the same error message.

And indeed after loading python3 and typing sys.path, I also don't see the path: /home/h/hswong00/miniconda3/lib/python3.9/site-packages

I am just wondering did I not edit the .bashrc file correctly so that python3 will search for that directory (python3.9/site-packages)? if I have done it correctly, how come that path doesn't show up when sys.path after loading python3?

could someone points out where my error is? I have searched for many of the previous posts regarding this on stackoverflow like someone suggests doing this (pip install -r requirements.txt) but it says no permission to do so. Please don't negative my posts delete if possible as I have tried but still no solution yet. I see the .bashrc file has been edit with the new entry added. But in python3, the sys.path don't show the newly added path. thanks

Back to Top