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

  1. While VSCode is open, go to the Code menu and select Preferences and then Settings.
  2. Type Inherit env in the search bar.
  3. Look for “Terminal > Integrated: Inherit Env
  4. If this is checked, please uncheck it.
  5. Restart VSCode by Quitting the application.
  6. Try running the command “which python” in the VSCode Terminal, and see if the output is different. Then, try re-running the code.