在Windows 7上将"python2"路径添加到命令行 [英] Add “python2” path to command line on Windows 7

查看:117
本文介绍了在Windows 7上将"python2"路径添加到命令行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图在Windows 7上将python2路径添加到命令行.

I've been trying to add the python2 path to command line on Windows 7.

我尝试过这种方式:

C:\>set python2 = C:\Python27\python.exe

但是cmd告诉我:

'python2' is not recognized as an internal or external command.

那么如何在Windows 7上将python2路径添加到命令行?

So how can I add python2 path to command line on Windows 7?

谢谢.

推荐答案

此答案是从我自己的答案复制而来的,并且为此问题量身定制.

This answer copied from my own answer, and customized to this question.

尝试执行以下命令.

set path=%path%;c:\python27

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

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

要永久设置PATH:

  1. 右键单击桌面上的我的电脑.
  2. 点击左侧的高级系统设置.
  3. 点击环境变量.
  4. 添加或更新PATH变量:
    • 如果不存在,请创建一个,并将值设置为C:\python27
    • 如果存在,则将;C:\Python27附加到现有值.
  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:\python27
    • If it exist, append ;C:\Python27 to existing value.

更新

如果要使用 python2 ,请复制可执行文件.

If you want to use python2, copy the executable.

CD C:\python27    
COPY python.exe python2.exe

这篇关于在Windows 7上将"python2"路径添加到命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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