Python 在 Windows 7 上将“django-admin.py”路径添加到命令行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17836416/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Add "django-admin.py" path to command line on Windows 7
提问by Michael
I've been trying to add the django-admin.py
path to command line on Windows 7.
我一直在尝试django-admin.py
在 Windows 7 上添加到命令行的路径。
I have tried to do it this way:
我试图这样做:
C:\>set django-admin.py = C:\Python27\Scripts\django-admin.py
But cmd
told me that:
但是cmd
告诉我:
'django-admin.py' is not recognized as an internal or external command.
So how can I add django-admin.py
path to command line on Windows 7?
那么如何django-admin.py
在 Windows 7 上向命令行添加路径?
I need it because later I'm doing this:
我需要它,因为稍后我会这样做:
C:\Users\Michael\Desktop\mysite>django-admin.py startproject mysite
Thanks.
谢谢。
采纳答案by falsetru
Try following command.
尝试以下命令。
set path=%path%;c:\python27\scripts
PATH
is set only for the cmd.exe in which you run the above command.
PATH
仅为运行上述命令的 cmd.exe 设置。
UPDATE
更新
To permanently set PATH:
永久设置路径:
- Right click My computerin the desktop.
- Click Advanced System Settingson the left.
- Click Environmental Variable.
- Add or Update
PATH
variable:- If it does not exist, create one, and set value as
C:\python27\scripts
- If it exist, append
;C:\Python27\scripts
to existing value.
- If it does not exist, create one, and set value as
- Restart cmd.exe. (PATH will not change for already launched cmd.exe)
- 右键单击桌面上的我的电脑。
- 单击左侧的高级系统设置。
- 单击环境变量。
- 添加或更新
PATH
变量:- 如果不存在,则创建一个,并将值设置为
C:\python27\scripts
- 如果存在,则附加
;C:\Python27\scripts
到现有值。
- 如果不存在,则创建一个,并将值设置为
- 重启cmd.exe。(对于已经启动的 cmd.exe,PATH 不会改变)