Wednesday, September 23, 2020

how to add python to windows path?

What is windows Path?

 

In windows, "path" is an environment variable that stores the location or the directory of the needed executables under a name to run them using the command prompt or the terminal.


without adding python to the windows path you cannot run the python commands like "PIP".

If you run pip on cmd without adding python to windows path you may get the following error even after installing pip on the system.

" 'pip' is not recognized as an internal or external command,   operable program or batch file."

Ways to add python to windows path 

Generally, there are two ways to add python to the windows path.


During the Installation of python:

Python can be easily added to the windows path installation,
During installation, you just have to click on the checkbox that says "Add python 3.8 to PATH".

python setup screen



It may vary according to the python version you are installing. In this tutorial, I am installing "Python 3.8". After that, you can proceed with the normal installation procedure and python will be added to the PATH automatically.

Adding python to windows path manually:

Step 1 (Environment Variable Screen):

Right-click on  "This PC" on your desktop screen and click on properties and jump to "step 2".

thisPc


If you are unable to find "this pc" on your desktop then go to the control panel and click on "System and Security"


Control panel


Then click on System

Step 2: Click on the "Advanced system settings" located at the left mid of the System window.
System settings


Step 3: After step 2 a new window named "System properties" will pop-up. Click on the "Environment variables" button, located at the bottom right.
System Properties

Now, If you see a variable named path than click on it and enter the add a new path to it i.e the path of python folder.
and click save.
"C:\Users\Username\AppData\Local\Programs\Python\Python38-32"
Path location may vary if you have installed python in a different directory other than the default one.

path Windows

Else click on new and give the variable name as Path, as shown in the following picture.
New Variable

and add the location of your python folder to value. In my case, the Variable value i.e location of the python file is

"C:\Users\Username\AppData\Local\Programs\Python\Python38-32"

Windows Path

Now click on ok and save the settings.
To confirm the settings open cmd and type "python" or "pip --version" if PIP is installed.
pip --version
# or run python if pip is not installed
If this command returns the version of  PIP then you have successfully added python to the windows path or in case if you have type "python" in the cmd then it should return the version of the python.

Output ( pip --version ):

pip

Output (python ):

python


No comments:

Post a Comment