简体   繁体   English

为什么我不想在安装时将Python.exe添加到我的系统路径?

[英]Why wouldn't I want to add Python.exe to my System Path at install time?

I'm reinstalling Python, on Windows 7, and one of the first dialog boxes is the Customize Python screen. 我在Windows 7上重新安装Python,第一个对话框之一是Customize Python屏幕。

The default setting for "Add Python.exe to Path" is "Entire feature will be unavailable." “将Python.exe添加到路径”的默认设置为“整个功能将不可用”。

I always change this to "Will be installed on local hard drive." 我总是将其更改为“将安装在本地硬盘上”。

It's not an issue, changing the system environment variables is a snap, but is there any upside to leaving this un-ticked? 这不是一个问题,改变系统环境变量是一件容易的事,但有没有任何好处让这个未被勾选?

If you only have one version of Python installed, it won't matter. 如果您只安装了一个版本的Python,那么无关紧要。

If you have multiple versions installed, then the first one that appears in your system Path will be executed when you use the "python" command. 如果安装了多个版本,则在使用“python”命令时将执行系统路径中出现的第一个版本。 Additionally, it can make older versions inaccessible without extra work. 此外,它可以使旧版本无法进行额外的工作。 For example, I had a system with Python 2.7 installed and I added 3.2 on top of that and checked the option to to add Python.exe to the path during installation. 例如,我有一个安装了Python 2.7的系统,我在其上添加了3.2并检查了在安装过程中将Python.exe添加到路径的选项。 After doing that, entering both "python" and "python3" on the command line opened up Python 3.2, so I would need to enter the full path to the 2.7 interpreter when I needed to execute 2.x scripts. 在这之后,在命令行中输入“python”和“python3”打开了Python 3.2,所以当我需要执行2.x脚本时,我需要输入2.7解释器的完整路径。

One upside I can think of is if you run multiple python versions in windows. 我能想到的一个好处就是你在windows中运行多个python版本。 So, you have c:\\python34 and c:\\python27 but both are in the path, you'll get whichever comes first, leading you to a possibly unexpected result. 所以,你有C:\\ python34c:\\ python27但两者的路径,你会得到以先到者为准,引领你到一个可能意想不到的结果。

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

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