简体   繁体   English

为 Anaconda2 设置 Windows 环境变量时遇到问题

[英]Trouble Setting up Windows Environment Variables for Anaconda2

I'm running Anaconda2 on Windows 7 and am having trouble running "python" from the command prompt.我在 Windows 7 上运行 Anaconda2,在命令提示符下运行“python”时遇到问题。

I added "C:\ProgramData\Anaconda2" to PATH in Environment Variables and it allows my to run "python" from CMD.我在环境变量的 PATH 中添加了“C:\ProgramData\Anaconda2”,它允许我从 CMD 运行“python”。 However, this is only true for CMD when I run it by clicking Start, typing cmd, and pressing enter.但是,这仅适用于 CMD,当我通过单击开始运行它时,键入 cmd,然后按 Enter。 If I shift+right click from a window and select "Open command window here" and try to run python, I get the error "'python' is not recognized as an internal or external command, operable program or batch file." If I shift+right click from a window and select "Open command window here" and try to run python, I get the error "'python' is not recognized as an internal or external command, operable program or batch file."

For example, in the command windows below, the top one was started by running CMD from the start menu and then running python.例如,在下面的命令 windows 中,顶部的命令是通过从开始菜单中运行 CMD 然后运行 python 来启动的。 The bottom window was opened by shift+right clicking in some location, selecting "Open command window here", then I even changed the directory to match the first window, but you can see "python" wasn't recognized.底部的window是通过shift+右键在某个位置打开的,选择“在此处打开命令window”,然后我什至更改了目录以匹配第一个window,但是你可以看到“python”没有被识别

CMD 蟒蛇

  1. Uninstall Python.卸载 Python。
  2. Right click My Computer (Or This PC if Windows 7+) > Properties > Advanced System Settings and click on Environment Variables.右键单击我的电脑(如果 Windows 7+,则单击此 PC)> 属性 > 高级系统设置,然后单击环境变量。
  3. In the user variables, select PATH and click on edit.在用户变量中,select PATH并单击编辑。
  4. Remove all the Python directories or delete the variable if there are no directories of other programs in the variable.如果变量中没有其他程序的目录,则删除所有 Python 目录或删除该变量。
  5. Reinstall Python重新安装 Python

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM