Linux operating system usually comes with Python installed. Many programs are developed and interpreted using Python. But sometimes while developing programs in Python user might see ` pip command not found error. As newly installed Linux distros do not have pip package as there is no need to just run programs.
If you encounter the error message "pip command not found" in Linux, it indicates that the Pip package manager is not installed or not properly configured. Here are a few steps you can follow to fix this issue:
STEP 1: Install Pip
- To open a terminal, you usually can find it in your applications menu or by using a keyboard shortcut (often Ctrl + Alt + T).
- Start by installing Pip if it is not already installed. Run the following command:
sudo apt-get install python3-pip
STEP 2: Update PATH variable
- After installing Pip, you may need to update your PATH variable to ensure that the system can locate the Pip executable.
- Open the .bashrc file in your home directory using a text editor:
nano ~/.bashrc
STEP 3:Add line at the end of file
Add the following line at the end of the file:
export PATH=~/.local/bin:$PATH
Save the file and exit the nano text editor. In nano, you can save by pressing Ctrl + O and then exit by pressing Ctrl + X.
STEP 4: Refresh the terminal:
To make the changes take effect, either restart your terminal or run the following command:
source ~/.bashrc
This command refreshes the terminal to apply the changes made to the .bashrc file.
STEP 5: Verify installation:
Finally, verify that Pip is installed correctly by running the following command:
pip --version
If successful, this command will display the installed Pip version information.
If you see the version information, it means Pip is installed and working correctly.
METHOD 2:
If you are still not able to install pip ,then try executing below commands in your terminal.
Run the following commands to download and run the script to install pip:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
By following these steps, you should be able to fix the "pip command not found" error in Linux and start using Pip to manage your Python packages.
METHOD 3:
STEP 1 : Download get-pip.py
- Open a terminal window.
- Navigate to the directory where you want to install pip.
- Run the following command:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
STEP 2 :Run the following command to install pip:
python get-pip.py
This will install pip in the current directory.
CONCLUSION
In conclusion,At start of linux distro installation it is generally occurred process that pip command may not be you may not able to find pip .The most common and recommended method to install pip on a Linux system is using the package manager with the following command:
- In Method 1 ,we had executed following set of commands:
sudo apt-get install python3-pip
nano ~/.bashrc
export PATH=~/.local/bin:$PATH
source ~/.bashrc
pip --version
- In Method 2, we had used following set of commands to install pip on our linux computer
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
- In Method 3, we had used the following set of commands to install pip in just two steps:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
This ensures a smooth installation process. However, if you encounter issues or prefer an alternative approach, running the get-pip.py script directly is a viable option.
If you have any further questions or concerns related to this article, feel free to comment below.
Thank you for reading!
Comments
Post a Comment