我为什么要在PATH中添加python [英] Why would I add python to PATH

查看:176
本文介绍了我为什么要在PATH中添加python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始研究python,所以当我找到一个教程时,它说要做的第一件事就是从www.python.org/downloads/

I am beginning to look at python, so when I found a tutorial it said that the first thing to do would be to download python from www.python.org/downloads/

现在,当我下载python 3时,我便开始安装并进入

Now when I downloaded python 3, I then started the installation and got to

我为什么要将Python 3.5添加到PATH"?什么是路径?为什么默认情况下未选中它?

Why would I want to "Add Python 3.5 to PATH"? What is PATH? Why is it not ticked by default?

推荐答案

PATH是Windows中的环境变量.它基本上告诉命令行在尝试查找文件时要查找的文件夹.如果您没有将Python添加到PATH,则可以从命令行像这样调用它:

PATH is an environment variable in Windows. It basically tells the commandline what folders to look in when attempting to find a file. If you didn't add Python to PATH then you would call it from the commandline like this:

C:/Python27/Python some_python_script.py

如果将其添加到PATH,则可以执行以下操作:

Whereas if you add it to PATH, you can do this:

python some_python_script.py

更短更整齐.之所以可以使用它,是因为命令行将浏览python的所有PATH文件夹,并在Python安装程序已添加到其中的文件夹中找到它.

Which is shorter and neater. It works because the command line will look through all the PATH folders for python and find it in the folder that the Python installer has added there.

默认情况下未选中它的部分原因是,如果要安装多个版本的Python,您可能希望能够控制默认情况下将打开命令行的哪个版本,如果 both 版本已添加到您的PATH.

The reason it's unticked by default is partly because if you're installing multiple versions of Python, you probably want to be able to control which one your commandline will open by default, which is harder to do if both versions are being added to your PATH.

这篇关于我为什么要在PATH中添加python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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