如何使用命令提示符设置Django

时间:2021-10-16 09:47:19

I have installed python correctly but I cannot figure out how to set the path using command prompt... I am confused is it the command prompt or the python shell which we have to use as the documentation states. This is the command but its not working

我已经正确安装了python但我无法弄清楚如何使用命令提示符设置路径...我很困惑的是命令提示符或我们必须用作文档状态的python shell。这是命令,但它不起作用

C:\Python34\;C:\Python34\Scripts;

C:\ Python34 \; C:\ Python34 \脚本;

As written in the documentation here: Docs Link

正如文档中所述:Docs Link

I am using windows.

我正在使用Windows。

4 个解决方案

#1


0  

That's not a command at all, and the documentation says quite clearly that it is what you need to add to the PATH environment variable.

这根本不是命令,文档非常清楚地说明了你需要添加到PATH环境变量中。

#2


0  

In Vista, Windows 7 and Windows 8 we can set path from command line using ‘setx’ command.

在Vista,Windows 7和Windows 8中,我们可以使用'setx'命令从命令行设置路径。

setx path "%path%;c:\directoryPath"

For example, to add c:\dir1\dir2 to the path variable, we can run the below command.

例如,要将c:\ dir1 \ dir2添加到路径变量,我们可以运行以下命令。

setx path "%path%;c:\dir1\dir2"

#3


0  

import sys
if "C:\\Python34" not in sys.path:
    sys.path.append("C:\\Python34")

print (sys.path)

This would work if you want to add python path using python script. But it would not be stable so it would be better if you manually add python path to environment variable.

如果你想使用python脚本添加python路径,这将工作。但它不稳定,所以如果手动将python路径添加到环境变量会更好。

#4


0  

I did it by using the control panel>system and security>system>advanced system settings. There is an option of adding environment variable, and added C:\Python34\;C:\Python34\Scripts; in the new option

我是通过使用控制面板>系统和安全>系统>高级系统设置完成的。可以选择添加环境变量,并添加C:\ Python34 \; C:\ Python34 \ Scripts;在新选项中

#1


0  

That's not a command at all, and the documentation says quite clearly that it is what you need to add to the PATH environment variable.

这根本不是命令,文档非常清楚地说明了你需要添加到PATH环境变量中。

#2


0  

In Vista, Windows 7 and Windows 8 we can set path from command line using ‘setx’ command.

在Vista,Windows 7和Windows 8中,我们可以使用'setx'命令从命令行设置路径。

setx path "%path%;c:\directoryPath"

For example, to add c:\dir1\dir2 to the path variable, we can run the below command.

例如,要将c:\ dir1 \ dir2添加到路径变量,我们可以运行以下命令。

setx path "%path%;c:\dir1\dir2"

#3


0  

import sys
if "C:\\Python34" not in sys.path:
    sys.path.append("C:\\Python34")

print (sys.path)

This would work if you want to add python path using python script. But it would not be stable so it would be better if you manually add python path to environment variable.

如果你想使用python脚本添加python路径,这将工作。但它不稳定,所以如果手动将python路径添加到环境变量会更好。

#4


0  

I did it by using the control panel>system and security>system>advanced system settings. There is an option of adding environment variable, and added C:\Python34\;C:\Python34\Scripts; in the new option

我是通过使用控制面板>系统和安全>系统>高级系统设置完成的。可以选择添加环境变量,并添加C:\ Python34 \; C:\ Python34 \ Scripts;在新选项中