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

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

问题描述

我开始看python,所以当我找到一个教程时,它说首先要做的是从www.python.org/downloads/下载python

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,您可能希望能够控制默认情况下打开哪个命令行,如果 两者 版本正在添加到您的路径中.

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.

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

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