Windows的“路径"如何?环境变量工作?
问题描述
当这个问题突然出现时,我最近将 python 添加到了我的环境变量中.当我在命令提示符中键入python"时,Windows 似乎知道要运行哪个文件.但是,我将 python 添加到这个名为Path"的环境变量中,并且从未在任何地方指定python".
当我输入python"时,我不明白 Windows 如何知道我想要什么.有人可以帮忙解决这个问题吗?
I recently added python to my environment variables when this question popped into my head. When I type "python" into command prompt, windows seems to know which file to run. However, I added python into this environment variable called "Path", and never specified "python" anywhere.
I don't understand how windows knows what I want when I type "python". Could someone help clear this up?
解决方案
PATH 是一个环境变量,保存与当前用户和操作系统相关的值.它指定可执行程序所在的目录.因此,当您键入 python 时,窗口会从 PATH 获取其可执行文件.因此,您无需在命令行中输入文件的完整路径.
PATH is an environment variable that holds values related to current user and operating system. It specifies the directories in which executable programs are located. so when you type python window gets its executable from PATH. hence, you won't need to type the whole path to the file on command line.
相关文章