Enviroment variable | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Enviroment variable

Hi, I just installed Python in my computer, and in the tutorial that i saw on YouTube the guy created an environment variable with the path of the Python’s folder. Then he opened the cmd and he just wrote “python” as an input and Python started. I did exactly the same as what he did and it didn’t work. Can someone tell me more about those “environment variables” and why it doesn’t work? Thank tou

14th Jan 2018, 9:36 PM
Davide Rigato
Davide Rigato - avatar
2 Answers
+ 3
Variables in the command prompt are basically shortcuts that can be used by typing in its name in cmd. The shortcuts can be used for accessing a specific directory quickly without having to type out the entire thing. Try seeing if you have the path set to the correct location, and if you do, see if you're typing in the correct shortcut name as you specified while you were creating the variable.
14th Jan 2018, 11:16 PM
Faisal
Faisal - avatar
+ 2
I'm a Linux user, so this is guesswork, but try: export python=<path/to/python3.exe> or similar in your startup file. There might be a Control Panel item with Environmental Variables. They are like variables in code: substituted. Eg: you could make "py" call Python or be equal to the word "pie". Check the Advanced part of Control Panel.
14th Jan 2018, 11:55 PM
non