简体   繁体   English

如何将现有的 django 项目移动到 pycharm

[英]how to move an existing django project to pycharm

tutorial --- venv --- lib --- include --- bin --- first --- manage.py教程 --- venv --- lib --- 包含 --- bin --- 首先 --- manage.py

my problem is , trying to open in pychrem and when i try to run the manage.py i have this error.我的问题是,尝试在 pychrem 中打开,当我尝试运行 manage.py 时出现此错误。 in terminal evreything work , but in pychrem not .在终端 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?

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

pip install django

You may have been running your Django project through a virtual environment, you could either download the framework to your main Python environment by running "pip install Django" in your terminal and continue your work however you could also locate your previous virtual environment and activate it by navigating to the venv directory (On Windows it should be your user folder) and running the activate script and then work from there.您可能一直在通过虚拟环境运行 Django 项目,您可以通过在终端中运行“pip install Django”将框架下载到您的主要 Python 环境并继续您的工作,但是您也可以找到您以前的虚拟环境并激活它通过导航到 venv 目录(在 Windows 上它应该是您的用户文件夹)并运行激活脚本,然后从那里开始工作。 (If Django wasn't installed on that environment either run the same pip command from earlier) (如果 Django 未安装在该环境中,请运行与之前相同的 pip 命令)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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