Translate

Friday, 6 March 2020

Solve Error ‘pip’ is not recognized as an internal or external command

In this tutorial, we are going to see various possible reasons for getting the error ‘pip’ is not recognized as an internal or external command.

Before starting with that let us first understand what pip is.

Pip is a package manager for python. Basically it is used to install packages, libraries and additional dependencies in case of Python. Previously pip was needed to be installed separately but since version 3.4 for Python 3 and version 2.7.9 for Python, it has been included in the Python installer.

We can get the error in case of pip because of the following reasons:

Pip is not installed:

In case of any version above the mentioned versions of Python pip is most probably already installed on your computer.

To check the version of python you are using simply run the command :

python --version

If your python version is greater than the above mentioned versions the most probable reason for getting this error is that path to your pip installation is not added to your PATH variable.

To check the PATH variable you can use the command:

echo %PATH%

By default, pip is present at C:\Python34\Scripts\pip. As pip comes bundled with python this path is to be added in the PATH variable, If it is not added you can add it to the PATH variable using the setx command:

setx PATH "%PATH%;C:\Python34\Scripts"

If the above command doesn’t work in the first attempt restart the cmd prompt it should work properly then.

Alternatively, you can also add a path using the graphical interface of windows you can go to Settings-> Advanced -> Environment Variables.  Select Path under User variables can click Edit, then you can add a new PATH. Just copy and paste the location of pip there (default C:\Python34\Scripts\pip ). This should solve the problem.

Note: If you are trying to do a fresh installation of python keep in mind to have the install pip and set PATH dialog box checked.

If you are using an older version of python it is recommended that you upgrade your python version to the latest as support for the previous version is over. Even if in some cases you can get pip to work using commands like:

python get-pip.py

You are going to run into a lot of problems because of the older version.

For the latest python version, you can visit the python official website and download the latest version. Uninstall the previous version and install a fresh copy that will come bundled with pip and you can directly set PATH variables while doing the installation.

Hope it solves the problem.

The post Solve Error ‘pip’ is not recognized as an internal or external command appeared first on The Crazy Programmer.



No comments:

Post a Comment