Why does the “pip: command not found” Error Occur?
The “pip: command not found” error occurs when the pip command is not installed on your system or when the system cannot locate the pip package manager, and here are some reasons that might be causing it:
- Pip not installed: If pip is not installed on your system, the terminal will not recognize the pip command.
- Path not set: If the path to the pip command is not set correctly in the Bash terminal, the system will not be able to locate the pip command.
- Incorrect pip version: If you have multiple versions of Python installed on your system, you might have installed pip for a different version of Python than the one you are currently using.
How To Correct the “pip: command not found” Error?
To correct the “pip: command not found” error, follow these steps:
Step 1: Check if pip is installed
Run the following command in the terminal to see if pip is set up on your machine:
If pip is installed, this command will display the version number of pip and if pip is not installed, you will see an error message:
If pip is not installed, you can install it using the following command:
This command will install pip on your system and if you are using a different version of Python, replace “python” with the version of Python you are using:
Step 2: Set the path to pip
If pip is installed, but the system cannot locate the pip command, you need to set the path to pip in the Bash terminal, and to do this run the following command:
This command sets the path to pip in the Bash terminal and if you have installed pip in a different location, replace “/usr/local/bin” with the path to the pip command on your system:
Conclusion
The “pip: command not found” error can be easily corrected by checking if pip is installed, installing it if necessary, setting the path to pip in the Bash, and checking the pip version. By following these simple steps, you can install and manage Python packages easily using pip in the Bash terminal.