Pip install is the command that downloads and sets up Python packages on your computer
Pip install is a command you type into your terminal or command prompt to add pre-written code libraries to your Python setup. When you run it, pip (which stands for "Pip Installs Packages") finds the package you named, downloads it from the internet, and puts it in the right place so your Python programs can use it. Without pip install, you would have to manually find, download, and organize every piece of code you wanted to use — which would take hours for even a small project.
The basic format is simple: you type pip install package-name, and pip does the rest. For example, pip install requests downloads the requests library, which lets you fetch web pages from inside your Python code. Pip also handles dependencies automatically — if the package you want needs other packages to work, pip installs those too.
Key Takeaways
- Pip install downloads Python packages and puts them where your Python programs can find and use them.
- The command is pip install package-name, typed into your terminal or command prompt, not into a Python file.
- Pip automatically installs any other packages that your chosen package depends on to work correctly.
- You can install a specific version of a package by typing pip install package-name==version-number instead of just the name.
- Pip comes built into Python on most systems, but you may need to use pip3 instead of pip if you have both Python 2 and Python 3 installed.
How to run pip install from your terminal
Open your terminal (on Mac or Linux) or command prompt (on Windows). On Windows, you can search for "Command Prompt" in the Start menu. On Mac, open Spotlight by pressing Command+Space, type "Terminal", and press Enter. On Linux, use Ctrl+Alt+T or open your terminal application from the menu.
Once the terminal is open, type the command exactly as it appears: pip install requests (or replace "requests" with whatever package you actually want). Press Enter and wait. Pip will show you what it is downloading and where it is putting the files. When it finishes, you will see a line that says "Successfully installed" followed by the package name and version number.
If you get an error saying "pip: command not found" or "pip is not recognized", your system may not have pip in its path, or you may need to use pip3 instead. Try typing pip3 install requests and pressing Enter. If that works, use pip3 for all future installs.
The difference between pip, pip3, and python -m pip
If you have both Python 2 and Python 3 on your computer, pip usually points to Python 2 and pip3 points to Python 3. Since Python 2 is no longer supported, you should use pip3 for new projects. Type pip3 install package-name instead of pip install package-name.
If neither pip nor pip3 works, try python -m pip install package-name or python3 -m pip install package-name. This tells Python to run pip as a module, which works even if pip is not in your system path. All three methods do the same thing — they just find pip in different ways depending on how your system is set up.
To check which version of Python each command uses, type pip --version, pip3 --version, or python -m pip --version. The output will tell you which Python version it is connected to. Use whichever one shows Python 3.
Installing a specific version of a package
By default, pip install downloads the newest version of a package. Sometimes you need an older version because your code was written for it, or because a newer version has a bug. To install a specific version, use two equal signs and the version number: pip install requests==2.25.1.
You can also install the newest version that is older than a certain number: pip install requests<3.0 installs the newest version 2 of requests. Or install the newest version that is at least a certain number: pip install requests>=2.20 installs version 2.20 or anything newer.
To see what versions of a package exist, go to pypi.org (the Python Package Index) in your web browser, search for the package name, and look at the "Release history" section. That page lists every version ever released and when it came out.
What happens when pip install runs
When you press Enter after typing a pip install command, pip connects to the Python Package Index (PyPI), a central repository where almost all Python packages live. Pip searches for the package name you typed, downloads the code and any packages it depends on, and installs them into your Python environment — usually a folder called site-packages inside your Python installation.
Once installed, you can use that package in your Python code by typing import package-name at the top of your file. Python will look in site-packages, find the package, and load it. If the install failed or the package was not found, you will see an error message telling you what went wrong — usually that the package name was spelled wrong, or that it does not exist on PyPI.
Pip also keeps track of what you have installed. Type pip list to see every package currently installed on your system, along with its version number. This is useful when you are trying to figure out if a package is already there, or what version you have.
Common mistakes and how to fix them
The most common mistake is typing the command in the wrong place. You must type pip install into your terminal or command prompt, not into a Python file or a Python interactive shell. If you open Python and see the >>> prompt, you are in the wrong place — type exit() to leave, then type pip install in your terminal.
Another common mistake is misspelling the package name. Package names on PyPI are case-sensitive and use hyphens, not underscores. If pip install my-package fails, try pip install my_package or search for the package on pypi.org to see the exact spelling. The error message will usually tell you the package was not found, which means you typed the name wrong.
If you get a permission error on Mac or Linux, do not use sudo to run the command with administrator rights. Instead, use pip install --user package-name, which installs the package just for your user account. Using sudo can break your Python setup. If you are using a virtual environment (a separate Python workspace for each project), you should not need --user at all — just type pip install package-name normally.
Using pip install with a requirements file
When you are working on a larger project, you might need to install dozens of packages. Instead of typing each one separately, you can create a text file called requirements.txt that lists them all. Each line should have one package name, and you can add a version number if you need a specific one.
A requirements.txt file looks like this:
requests==2.25.1 flask==2.0.1 numpy pandas>=1.2.0
Once you have created this file, type pip install -r requirements.txt and pip will install every package listed, with the exact versions you specified. This is how teams share projects — one person creates the requirements.txt file, commits it to version control, and everyone else can run one command to get the exact same packages.
Frequently Asked Questions
Do I need to install pip separately, or does it come with Python?
Pip comes built into Python 3.4 and newer, so you should have it already if you installed Python recently. On older systems or some Linux distributions, you may need to install it separately by running sudo apt-get install python3-pip (on Ubuntu or Debian) or the equivalent command for your system. Check by typing pip --version in your terminal.
What is the difference between pip install and conda install?
Conda is an alternative package manager that comes with Anaconda, a Python distribution aimed at data science. Pip installs packages from PyPI, while conda installs from the Anaconda repository. For most general Python work, pip is standard. If you installed Anaconda, you can use either, but conda is usually preferred in that environment.
Can I use pip install on a Mac or Linux computer the same way as on Windows?
Yes, the command is identical. The only difference is how you open the terminal — use Terminal.app on Mac or your terminal application on Linux, instead of Command Prompt on Windows. The pip install command itself works the same way on all three systems.
What does it mean if pip install says "Requirement already satisfied"?
That package is already installed on your system. Pip checked and found it, so it did not download it again. If you need a different version, use pip install --upgrade package-name to get the newest version, or pip install package-name==version-number to install a specific one.
Can I uninstall a package after I install it with pip?
Yes, type pip uninstall package-name and pip will remove it. You will be asked to confirm by typing "y" and pressing Enter. This is useful if you installed something by mistake or no longer need it for a project.