I've just started a new job that requires me to do some Python programming and scripting for software automation. I've encountered the terms 'PATH' and 'environment variables' before, especially when I need to direct the system to the Python installation, but I really don't understand what they are. Can anyone explain what these concepts are and suggest some resources for learning more about them? Thanks!
1 Answer
Environment variables are like special placeholders that applications use to store information. For instance, you might have a variable named NAME that equals 'Ben'. This allows different software on your system to refer to your name without needing to know it directly. The PATH variable is a list of directories where your system looks for executable files. If you want to run something like Python without typing out its full path, it needs to be in the PATH variable. So essentially, when you run `python.exe`, the system checks the paths listed in the PATH variable until it finds that executable. You can also add locations for external libraries to make importing them much easier!
So just to clarify, when I set the path for Python, the computer knows exactly where to look for the executable when I run it?