Skip to main content

How to Fix "pip command not found" in Linux


L
inux 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

  1. To open a terminal, you usually can find it in your applications menu or by using a keyboard shortcut (often Ctrl + Alt + T).
  2. 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

  1. After installing Pip, you may need to update your PATH variable to ensure that the system can locate the Pip executable.
  2. 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

g2

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

python 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

  1. Open a terminal window.
  2. Navigate to the directory where you want to install pip.
  3. 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

Popular posts from this blog

Is Dart easy for Beginners?

Lets look up few question on dart which help us to understand whether dart is easy or not. Introduction: Dart syntax are derived from java,c++ and mostly from javascript.It has c like syntax .Hence it is beginner friendly untill you understand the concept of classes. Hence here are few Questions on Dart programming language. Dart Question Question on Dart 1) For what iterable Collection in dart? Ans : The iterable Collection in dart :The  Iterable  class—for example  List  and  Set.  Iterables are basic building blocks for all sorts of Dart applications, and you’re probably already using them, even without noticing. This codelab helps you make the most out of them. 2 )What are type of loops in dart programming? Ans :/ for in loop ,switch Dart programming language supports several types of loops for controlling the flow of execution. Here are the main types of loops in Dart: For Loop: The for loop is used to iterate a specific number of times. It consists of an initialization, a cond

How To Change The Owner Of A Directory Using Python?

Introduction: To change the permission of a directory or file in python you needed to know two thing your user name and user group you wanted to change I will going to describe in detail how to know your users on your computer and user group present on your computer, whether you are the window or linux or mac. Syntax : There are three main commands we can use are 1st command(main command) os.chown(directory_name,userid,groupid) Parameters: userid - user id is the parameter used to specify the user id. groupid - Is the group id used for specifying the group of the group id. 2nd command: usr.getpwnam(new_owner_user).pw_uid Above function returns user id. when username is passed as argument. 3rd Command: grp.getgrnam(new_owner_group).gr_gid Above function returns group id. when groupname is passed as argument. Sample Program : Python3 import os # Directory path you want to change ownership for directory_path = '/tmp/directory' # New owner user and group new_owner_user = 'ch

Best Linux distros of 2023

  Introduction Linux, the open-source operating system, has a plethora of distributions tailored to diverse user needs. These distributions, or "distros," vary in design, focus, and functionalities, making Linux a versatile choice. In this article, we'll explore ten noteworthy Linux distributions and delve into their unique features and capabilities. Distro 1 - Ubuntu Ubuntu is one of the most popular Linux distributions. It's known for its user-friendly interface and robust community support. Ubuntu is based on Debian and offers a balance between ease of use and powerful features. Features of Ubuntu: Desktop Environment : Utilizes the intuitive GNOME desktop environment, providing a clean and efficient interface. Software Repository: Offers an extensive software repository accessed through the APT package manager, ensuring a vast selection of applications. Security and Updates: Regularly provides updates and security patches to enhance system stability and protect