添加“django-admin.py"Windows 7 上的命令行路径

2022-01-18 00:00:00 python windows django cmd windows-7

问题描述

我一直在尝试将 django-admin.py 路径添加到 Windows 7 上的命令行.

I've been trying to add the django-admin.py path to command line on Windows 7.

我尝试过这样做:

C:>set django-admin.py = C:Python27Scriptsdjango-admin.py

但是 cmd 告诉我:

'django-admin.py' is not recognized as an internal or external command.

那么如何在 Windows 7 上将 django-admin.py 路径添加到命令行?

So how can I add django-admin.py path to command line on Windows 7?

我需要它,因为稍后我会这样做:

I need it because later I'm doing this:

  C:UsersMichaelDesktopmysite>django-admin.py startproject mysite

谢谢.


解决方案

试试下面的命令.

set path=%path%;c:python27scripts

PATH 仅为运行上述命令的 cmd.exe 设置.

PATH is set only for the cmd.exe in which you run the above command.

更新

永久设置路径:

  1. 右键单击桌面上的我的电脑.
  2. 点击左侧的高级系统设置.
  3. 点击环境变量.
  4. 添加或更新 PATH 变量:
    • 如果不存在,则创建一个,并将值设置为C:python27scripts
    • 如果存在,将 ;C:Python27scripts 附加到现有值.
  1. Right click My computer in the desktop.
  2. Click Advanced System Settings on the left.
  3. Click Environmental Variable.
  4. Add or Update PATH variable:
    • If it does not exist, create one, and set value as C:python27scripts
    • If it exist, append ;C:Python27scripts to existing value.

相关文章