Note: This guide assumes that you have installed Anaconda, Django, and VSCode installed.
If you’re still getting errors such as “Django not installed”, we want to first diagnose which python interpreter is being used by VSCode.
To do this, run either of the following commands from the VSCode terminal:
which python
OR
which python3
If your output matches either of the options below, you’ll likely need to follow the steps below:
Incorrect “which python” result:
/usr/bin/python
Incorrect “which python3” result:
/usr/local/bin/python3
Stop VSCode from Inheriting the Virtual Environment
- While VSCode is open, go to the Code menu and select Preferences and then Settings.
- Type Inherit env in the search bar.
- Look for “Terminal > Integrated: Inherit Env“
- If this is checked, please uncheck it.
- Restart VSCode by Quitting the application.
- Try running the command “
which python
” in the VSCode Terminal, and see if the output is different. Then, try re-running the code.