简体   繁体   中英

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?

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.

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

$ source ./venv/bin/activate

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM