首页 > 解决方案 > 找不到 Django 'django-admin' 命令。django版本:2.2

问题描述

我正在尝试使用 django-admin 但遗憾的是它无法正常工作,我必须使用python -m django 如何修复它给出的命令行异常:

django-admin : The term 'django-admin' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ django-admin version
+ ~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (django-admin:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

标签: pythondjango

解决方案


使用虚拟环境来处理 python 和 Django 项目,你可以从这个站点安装它。激活虚拟环境后,安装 Django 并运行它:

python -m pip install Django
django-admin startproject mysite

转到站点目录并运行应用程序:

py manage.py run server.

从这里您可以阅读官方文档并按照教程进行操作。


推荐阅读