简体   繁体   English

如何修复“django-admin 无法识别”

[英]how to fix "django-admin not recognized"

I just formatted my OS due some reason so installed python and django again.由于某种原因,我刚刚格式化了我的操作系统,所以再次安装了 python 和 django。 I tried to create the python project in the same environment as previous project but unlike that it does not recognizes the "django-admin" command please help me to solve this issue.我试图在与以前的项目相同的环境中创建 python 项目,但与它不同的是它不识别“django-admin”命令请帮助我解决这个问题。

I tried reinstall it with pip and also created the environmental variable for django still not worked.我尝试用 pip 重新安装它,还为 django 创建了环境变量,但仍然没有用。

Screenshot:截屏:在此处输入图像描述

Make sure you installed Django in the virtualenv you are currently using.确保您在当前使用的 virtualenv 中安装了 Django。 Also make sure you added the django-admin.py file to your Python PATH.还要确保将django-admin.py文件添加到 Python PATH。

If you want to start your project now and reinstall and fix the PATHs later, you can do:如果您想现在开始您的项目并稍后重新安装和修复 PATH,您可以执行以下操作:

<path_to_django-admin.py> startproject <project_name> 

# An example
C:\Python3.7\Scripts\django-admin.py startproject myproject

If You installed everything well and good you have pip and Django set, try this one, in your terminal如果你安装的一切都很好,你有 pip 和 Django 设置,试试这个,在你的终端

python -m django startproject NameofProject

请在 vs code powershell 上试​​试:python -m django startproject Project

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

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