J.wang
J.wang

Reputation: 43

Django ImportError: Couldn't import Django

I have a project about django web, this project has no problem on other computers, but pycharm on my own laptop prompts for the following information

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

I use PyCharm Professional and PyCharm3 My system is Windows 10. Can someone help?

Upvotes: 1

Views: 5823

Answers (2)

Calamar
Calamar

Reputation: 1637

For me it worked with deactivate and then source the venv again. From the outer folder:

$ source ./venv/bin/activate

Upvotes: 0

DDiran
DDiran

Reputation: 573

Your question is a bit vague as you haven't included any details about your setup/config and what steps you took to get the error, but usually these types of errors are down to a single step that has been missed during the initial installation/setup process.

I would recommend checking whether Python is properly configured and has been added to system path. Also check whether you've got Django installed with pip freeze (if you're in a virtual environment make sure you activate it and then run the command).

Alternatively here's a basic Django setup guide which you can run through and as well as a PyCharm-specific Django setup guide.

If all else fails, you should try re-installing both Python and PyCharm and try again.

Upvotes: 2

Related Questions