Python packages, just like other app packages can also be installed using the native CMD terminal. PIP or PiP installs Package is a system that handles Python packages and libraries. When the PIP path is not clarified as a system variable on your device, you’ll see the “pip’ is not recognized as an internal or external command” on the terminal screen. Just create a new system variable along with the installation path and CMD will recognize it.
Fix 1 – Check whether the variable exists
At first, you should run a small test to identify whether the PIP installation variable already exists on your computer.
1. At first, tap the Windows key from your keyboard once.
2. Then, write down “cmd” there in the search bar. After this, just right-click on the “Command Prompt” search results and tap “Run as administrator“.
3. Just when you reach the CMD terminal, execute this command to list out the specific installation paths that are present on your system.
echo %PATH%
Go through the result of the query very carefully and check whether you can identify a path like this –
C:\Program Files\Python310\Scripts
If you can’t identify any such Python-related path, just go to Fix 2 to add a new system variable along the installation path.
Most users wouldn’t find the related path. But, those who do, understand there are some issues with the integrity of the installation path. Go to the
Fix 2 – Add a system variable
You can add a new system variable to your system directing to the installation path of Python.
1. You have to open the System Properties page. So, press the Windows key+R keys together.
2. Then, type this there in the Run box and click “OK“.
sysdm.cpl
3. When you reach the System Properties page, go ahead to the “Advanced” section.
4. There, click on “Environment Variables“.
5. Now, here you can see two distinct types of variables. One is the User Variable and System Variables.
6. In the System variables tab, select the “Path” variable.
7. After that, click the “Edit…” option so that you can edit the path.
8. Coming to the Edit environment variable page, click “New” to add a new system variable.
9. Now, paste the address of the PIP installation. Usually, the default location of Python 3.10 is this –
C:\Program Files\Python310\
10. Finally, click “OK” to finish the process.
11. On the Environment Variables page, click “OK” to save the settings.
12. Finally, click “Apply” and “OK” to save the new variable on your computer.
Once you have added this new variable, close everything. Then, restart your computer after this.
After restarting the system, try to run the PIP command once more. Check if this helps you solve the problem.
Fix 3 – Add the environment variable using CMD
If you are facing trouble adding a new system variable along the PIP installation path, you can do the same using a CMD command.
1. At first, press the Windows key and write “cmd” there.
2. Then, as you see the “Command Prompt” in the search results and tap “Run as administrator“.
3. Once you have opened the CMD terminal as an administrator, paste this
setx PATH "%PATH%;Pythoninstallationpath"
NOTE – Replace the “Pythoninstallationpath” with the path where Python is installed on your computer.
In our computer, the installation path is this – C:\Program Files\Python310\Scripts
So, the command is –
setx PATH "%PATH%;C:\Program Files\Python310\Scripts"
After executing this path, close the terminal.
Then, restart your computer. After restarting the system, try installing a package using the PIP command.
Fix 4 – Use another command
You can navigate to the Python package folder and use the PIP executable directly from the command line.
1. At first, right-click the Windows icon and tap “Run“.
2. Then, type this and press the Ctlr+Shift+Esc three keys together to open the terminal as an administrator.
cmd
3. When you reach the CMD terminal, navigate to the folder that contains the Python package.
cd packagefolder
Here, the “packagefolder” indicates the folder containing the python package on the system. Replace that with the folder consisting of the Python packages on your computer.
Example – In our system, the python package is located in the “PythonPackages” folder. So, the code is –
cd C:\PythonPackages
4. Now, copy-paste this command and modify it, and hit Enter.
C:\Program Files\Python310\Scripts\pip.exe install [nameofthepackage].whl
[NOTE – Replace the “nameofthepackage” with the name of the Python package that you are trying to install.]
Example – We are trying to install the “glumpy-1.0.6.whl” package, So, the command will be –
C:\Program Files\Python310\Scripts\pip.exe install glumpy-1.0.6.whl
This way, you can easily install the package by directly using Pip.exe. It is a workaround but it will work on your system for sure.
Fix 5 – Modify the Python installation
Repairing the Python installation on your system to add the PIP package again.
1. Open the Run box. To do that, press the Win key with the R key.
2. Then, write this in the Run box and hit Enter.
appwiz.cpl
3. This will lead you to the Programs & Features settings on your computer.
4. You can see the complete list of installed apps here. Find out the “Python” application here.
5. Once you have found it, right-tap that and click “Change” to modify the app on your computer.
6. This will open the Python Setup screen. Tap “Modify” from the list of options.
7. In the Optional Features page, make sure that you have checked the “pip” check box.
8. Then, tap “Next” to proceed.
9. Finally, click “Install” to modify the installation process and install the Python package on your computer.
After this, open an elevated CMD terminal and use the PIP command to install a Python package.
Check whether you are still seeing the error message or not.
Fix 6 -Uninstall Python and reinstall it
If nothing is working, try uninstalling the main Python package and reinstalling Python along with the components on your computer.
Step 1 – Uninstall all the Python-related apps
1. Press the Windows key along with the X keys together.
2. Then, tap “Apps and Features” to open the Apps and Features page.
3. In the Apps & Features page, on the right-hand pane, look for “Python 3.10.7” or Python-related apps.
4. Then, click on ⋮ menu and click on “Uninstall” to uninstall the app.
5. You will be asked again. So, tap “Uninstall“.
Just wait for Python Setup to uninstall all the components from your computer.
Once you have uninstalled it, exit the Settings page.
Step 2 – Use the Python executable file
Now, you can download the latest Python executable file to install the Python packages using the latest Python executable file.
1. Go to Python release lists.
2. Here, you can see two types of Release channels. In the ‘Stable Releases’ option, look for the latest build with options to download packages.
3. So, tap “Windows installer (64-bit)” to download the installer file.
[If you are a 32-bit user, you have to download the 32-bit Windows installer.]
4. After this, go to the download location and double-tap the Python executable file to run the installer.
5. On the first page of the installer, tick mark the “Add Python 3.10 to PATH” check box.
6. Then, tap “Customize installation” so that you can take control of the installation.
7. After this, check the “pip” box on the following page.
8. Next, tap “Next” to proceed.
9. Now, don’t change any of the settings or interfere with the install location.
10. Tap “Install” to install all the components of the Python components.
Now, just wait for the Python installer to install all the components of the package.
Once Python is installed, open the elevated command prompt page and try to load a Python package using the “pip” command. If you are still seeing the “pip is not recognized as an internal or external command” error message, follow these steps –
1. You have to open the CMD terminal. Just click on that Windows key and type “cmd“.
2. Then, right-tap “Command Prompt” in the search results and tap “Run as administrator“.
3. When the CMD terminal page appears, write down this line and hit Enter to ensure pip is installed.
python -m ensurepip --default-pip
After this, close the CMD terminal. Then, from the same terminal page, try to install any package of your choice using the pip command.
Your problem will be solved for sure.