pip is a package manager for Python. It’s basically the package manager for Python, and it allows you to install and manage libraries and dependencies that aren’t part of Python standard library.
Especially if you know one of these package managers, it’s important that you don’t think, “Oh,
pip is just exactly like, for example, npm,” because some of the package managers that you are seeing here, they fulfill way more tasks than just managing external packages.
pip can be helpful for a bunch of tasks too, but to keep things basic in this course, you only need to remember this. The
pip package manager is there for you to install, update, or uninstall external packages.
01:05 External packages are third-party packages that are not part of the Python standard library.
One cool thing about
pip is that it comes with your Python installation right away. So if you have the terminal open, you can check it on Windows with
pip --version, and on macOS or Linux with
python3 and the same command to see the version of
pip that’s installed on your system.
Running this command in the terminal shows you which version of
pip your standard Python installation works with.
Okay, so here you see me in my terminal on macOS. That’s why I will use the
python3 as the command. If you’re on Windows, you need to use the
And when I type
python3 -m pip
--version and press Enter, then you see that the output says that my version is
pip 22.0.3 from
For you, both the
pip version and the Python version can be different, of course. My version of
pip seems a bit out of date. So since
pip is a Python package itself, you can use
pip to update
The beginning of the command to update
pip is the same like when you’re checking the version. It’s either
python3 -m pip, ao that means you want to do something with
pip and then you use the
install command with the
Then you write
pip at the end because you want to upgrade the
pip package. Let’s have a look how this command works in action.
pip, you type
python3 -m pip install
--upgrade pip, and then you press Enter. And if a newer version of
pip is available, then it will be downloaded and installed. Otherwise, you’ll see a message indicating that the latest version is already installed.
03:18 This message usually says something like requirements already satisfied. Well, actually, let’s check what this message exactly says. You can press ↑ to traverse through your command history in the terminal.
That’s a convenient way to get a command you used before, and when you press Enter, you perform the command again. So here I have the
python -m pip install --upgrade command.
So if I press Enter, then you see that it says, indeed,
already satisfied because we just updated
pip, so there is nothing for
pip to update there.
pip install, you install packages into your Python environment. So now that you upgraded your
pip version, your standard Python version works with the current
Installing packages into your standard Python version is not ideal, though. It’s okay for packages like
pip that you want to use system-wide.
04:16 However, for other packages, you should be a bit more selective. Instead of installing them system-wide, you want to install them in something called virtual environment.
04:28 In the next lesson, you’ll learn about what a virtual environment is and how you can use it in Python.
Become a Member to join the conversation.