python - 如何将现有的 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?
解决方案
只需转到您的命令行并键入以下内容:
pip install django
推荐阅读
- sql - 比较两个不同但结构相同的数据库中的两个表未返回预期结果
- reactjs - 无法使用 typescript 从 redux 工具包访问数据
- java - 如何使用给定的类从字符串数组实现二叉树,然后对其进行序列化、反序列化和遍历?
- arrays - 没有正确打印数组的值(非常初学者编程)
- docker - 如何将应用程序打包到能够在 Kubernetes 中的 Spark 集群上运行的 docker 镜像中?
- python - 如何在 tkinter 中创建一个全局变量?
- java - 如何在 Java 中处理陈旧的池连接
- apache - 通过 Apache 将特定用户代理限制为 Internet Explorer?
- javascript - 最初填充的道具值,然后不在反应js中
- node.js - 部署MEAN堆栈,Mongo没有输出结果