by @kodeazy

pip is not recognized as internall or external command

Home » python » pip is not recognized as internall or external command

I was trying to install pip by executing below two commands in command prompt.

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py

Below is the output I got for both the commands

C:\Users\XXXX>curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 2513k  100 2513k    0     0  1047k      0  0:00:02  0:00:02 --:--:-- 1048k
C:\Users\XXXX>python get-pip.py
Collecting pip
  Using cached pip-23.0.1-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 23.0.1
    Uninstalling pip-23.0.1:
      Successfully uninstalled pip-23.0.1
Successfully installed pip-23.0.1

when I try to run the pip command using command prompt I got the below error

C:\Users\XXXX>pip
'pip' is not recognized as an internal or external command,
operable program or batch file.

Here to resolve the issue we have to add the scripts folder path of python in environment variable.
To get the scripts path of variable open cmd and execute below command in python.

import sys
sys.executable

sys.executable will give the executable file path of python.
as below

C:\Users\XXXX>python
Python 3.10.1 (tags/v3.10.1:2c8a, Dec  6 2021, 19:10:37) [MSC v.19 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.executable
'C:\\Users\\XXXX\\AppData\\Local\\Programs\\Python\\Python310\\python.exe'
>>>

C:\\Users\\XXXX\\AppData\\Local\\Programs\\Python\\Python310\\python.exe is the path ofpython.exe file.
python.exe file parent folder python310 has scripts folder.
Below is my scripts folder path.
C:\Users\XXXX\AppData\Local\Programs\Python\Python310\Scripts.

Now add the above scripts path to path variable in environment variable as shown in below screenshot.

Image not found