命令“ django-admin.py startproject mysite”未能识别 [英] command "django-admin.py startproject mysite" not recognized

查看:159
本文介绍了命令“ django-admin.py startproject mysite”未能识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑:我将django-admin.py的路径添加到了系统路径(C:\Users\me\Downloads\Django-1.5。 1\django\bin),但是即使在此之后,当我尝试运行django-admin.py startproject mysite时,它也会要求我选择要打开的文件,即使选择python.py ,由于某种原因,它会在chrome中打开。我也尝试了python django-admin.py startproject mysite,但是它说

I added the path to django-admin.py to my system path (C:\Users\me\Downloads\Django-1.5.1\django\bin) but even after this when I try to run django-admin.py startproject mysite, it asks me to pick a file to open with and even when I pick python.py, it opens in chrome for some reason. I also tried python django-admin.py startproject mysite but it says


python:无法打开文件django-admin.py:[ Errno 2]没有这样的文件或目录

python: can't open file django-admin.py: [Errno 2] No such file or directory

任何想法都错了吗?

我在系统路径中添加了python27,当我打开cmd并切换到目录(C:\Users\me\djcode)时,输入django-admin.py startproject mysite它说

I added python27 to the system path and when I open up cmd and switch to a directory (C:\Users\me\djcode) and then type in django-admin.py startproject mysite it says


django-admin.py无法识别为内部或外部命令,可操作程序或批处理文件

django-admin.py is not recognized as an internal or external command, operable program or batch file

当我尝试键入命令python django-admin.py startproject mysite时,它说

When I try typing the command python django-admin.py startproject mysite, it says


python:无法打开文件django-admin.py:[Errno 2]没有这样的文件或目录

python: can't open file django-admin.py: [Errno 2] No such file or directory

知道为什么吗?

在djangobook中( http ://www.djangobook.com/en/2.0/chapter02.html )它说

In the djangobook (http://www.djangobook.com/en/2.0/chapter02.html) it says


django-admin.py如果您是通过Django的setup.py实用程序安装Django的,则应该在系统路径上

django-admin.py should be on your system path if you installed Django via its setup.py utility

这是什么意思?如何将django-admin.py添加到系统路径?我不确定django-admin.py在哪里。

what does this mean? how do I add django-admin.py to my system path? I am not sure where django-admin.py even is.

推荐答案

找到django-admin.py所在的文件夹。然后转到控制面板>系统>高级系统设置>环境变量。在用户变量和/或系统变量中,搜索称为PATH的条目。通过添加您之前找到的文件夹进行修改,使用其他条目作为指导,基本上只是确保它们之间用; 分隔。如果您已完成所有这些步骤,但是在执行操作之前仍处于与您使用的相同的cmd提示符下,请关闭它并打开一个新的提示符,以便它接受您的更改。

Find the folder where django-admin.py is located. Then go to Control Panel > System > Advanced System Settings > Environment Variables . In the User Variables and/or System Variables, search for an entry called PATH. Modify it by adding the folder you found earlier, use the other entries as guidance, basically just make sure they're separated by ;. If you have done all these steps, but are still in the same cmd prompt that you were using before doing them, close it and open a new one so it picks up on your changes.

这篇关于命令“ django-admin.py startproject mysite”未能识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆