如何在 Windows 中将 python 添加到 cmd

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4882808/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 17:58:18  来源:igfitidea点击:

How can I add python to cmd in windows

pythonwindowspython-3.x

提问by srisar

I have python 3.1 installed, and I have added it to the system path too. Now I can open "cmd" and type python to start python, but whenever I try to open cmd in a specific directory by using (shift + right click -> open command prompt here), and type python, it says "command not found"!

我已经安装了 python 3.1,并且我也将它添加到了系统路径中。现在我可以打开“cmd”并输入python来启动python,但是每当我尝试使用(shift+右键单击->在此处打开命令提示符)在特定目录中打开cmd并输入python时,它会显示“找不到命令“!

How can I fix this?

我怎样才能解决这个问题?

采纳答案by user225312

You need to set up the environment variablesin Windows.

您需要在 Windows 中设置环境变量

回答by swastik

Right click on my computer>got to properties>advanced settings>environmental variables>

右键单击我的电脑>进入属性>高级设置>环境变量>

choose path and add the installed python dirtory to that path as like below:

选择路径并将安装的pythondirty添加到该路径,如下所示:

C:\WINDOWS\system32;C:\WINDOWS;C:\Python27

C:\WINDOWS\system32;C:\WINDOWS;C:\Python27