pip is not recognized as an internal or external command

pip-is-not-recognized-as-an-internal-or-external-command-solved

We all know pip is the most important command while installing, upgrading, or managing any Python library. If you are new to Python you may face “pip is not recognized as an internal or external command” error while installing any package, this article is to show you different methods to solve or bypass this error.

If you want to learn Python from basic then this is the must-have Udemy course for you: 100 Days of Code: The Complete Python.

While installing any Python package using pip command, you may get an error like below:

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

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

Solution1: Check Your Python Installation

This error typically occurs when the system cannot locate the pip command in the system’s PATH. You should always make sure to check the box that says “Add Python to PATH” during the installation of Python or Anaconda in your system.

add-python-to-path-while-installing-python-or-anaconda

After installation, to check if Python is working, open a new command prompt and type python --version. You should see your Python version.

To check if pip is there, type pip --version.

check-python-and-pip-version-in-windows-cmd

Solution2: Add pip Installation Path

If you miss to add variable path while installing Python, you can add that later. To add variable path, you need to find your Python installation directory. You need to provide Script path as the variable path.

Also Read:  Install TensorFlow GPU with Jupiter notebook for Windows

I installed Anaconda Python inside D:\ drive. For me, the Script path is: D:\Anindya\D\Installation\Anaconda3\Scripts. So I am going to use that path as my variable path.

Once you find that, click the start icon and navigate to the Control Panel → System and Security → System. Then click “Advanced System Settings” on the right side of the panel (or simply you can search “variable” in the start search bar).

Once there, click Environment Variables on the bottom right and there will be two boxes, an upper and a lower box. In the upper box: Click on the ‘Path‘ Variable and click Edit located on the right. Click New and paste your directory Path. It should look something like this:

edit-or-add-python-or-anaconda-variable-path-to-solve-pip-is-not-recognized-as-an-internal-or-external-command-error

Click OK three times, open a new window of cmd, and type: pip. See if it works. Now you should not get “pip is not recognized as an internal or external command” error.

Now this is the process to add pip path in Windows (I tried it in Windows 10). If you are using Linux or Ubuntu, you can do this by below set command (this command will also work in Windows):

setx PATH "%PATH%;D:\Anindya\D\Installation\Anaconda3\Scripts"

Solution3: Use Python’s -m Flag

I know sometimes in office laptop it is difficult to edit variable path and installing fresh Python again. In that case, you can use -m flag while installing any Python packages.

Python allows you to run modules as scripts using the -m flag. Just type: python -m pip install package-name and see if that works.

Also Read:  Install OpenCV GPU with CUDA for Windows 10

Just to Add

There are mainly three solutions to solve “pip is not recognized as an internal or external command” error, which I shared. It might sound silly, but sometimes we mess up the command because of a tiny mistake. Check carefully for typos or spaces in your command before going into those solutions.

Remember, the steps might change a bit depending on whether you’re using Windows, macOS, or Linux. Look up guides for your specific system to get accurate instructions.

Leave a comment