首页 > 解决方案 > 如何将现有的 django 项目移动到 pycharm

问题描述

tutorial --- venv --- lib --- include --- bin --- first --- manage.py

我的问题是,尝试在 pychrem 中打开,当我尝试运行 manage.py 时出现此错误。在终端 evreything 工作,但在 pychrem 没有。

/usr/local/bin/python3.8 /Users/alekseyzgeria/Desktop/tutorial/manage.py
Traceback (most recent call last):
  File "/Users/alekseyzgeria/Desktop/tutorial/manage.py", line 11, in main
from django.core.management import execute_from_command_line

ModuleNotFoundError: No module named 'django'


**The above exception was the direct cause of the following exception:**

File "/Users/alekseyzgeria/Desktop/tutorial/manage.py", line 22, in <module>
main()


 File "/Users/alekseyzgeria/Desktop/tutorial/manage.py", line 13, in main
raise ImportError(

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?

标签: pythonpython-3.xdjango

解决方案


只需转到您的命令行并键入以下内容:

pip install django

推荐阅读