[Django] ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH envrionment variables? Did you forget to activate a virtual environment?

[Django] ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH envrionment variables? Did you forget to activate a virtual environment?

Goal

  • To know why this problem occurs
  • To solve this problem


Problem

  • When I ran Djang application in PyCharm IDE, this error occured.
  • I used Anaconda virtual env for my project.
  • I installed Django in my default Python. However I didn’t install it in virtual env.

screenshot001


Solution

1. Activate virtual env and install Django

1.1. Check virtual env name and path

screenshot002

1.2. Activate virtual env which is used in my project

$ conda activate [ENV_NAME]

1.3. Install Django

(env) $ pip install django

screenshot003


2. Run Django application

screenshot004

screenshot005



References

댓글남기기

-->