Як встановити pip у Python: способи для Windows, macOS і Linux

How to Install pip in Python on Windows, macOS, and Linux

How to install pip in Python is one of the first things to check when you need to install libraries, update tools, or run a project with dependencies. In most modern Python installations, pip is already included, but sometimes it has to be added manually or fixed in the system path.

What pip is and when it needs to be installed

pip is Python’s package manager for installing libraries from official repositories and managing project dependencies. If the pip command does not run, the system cannot find it, or Python was installed without the extra components, pip needs to be installed separately.

The problem usually looks like this: Python itself works, but when you try to install a package, you get an unknown command error or a missing module message. In that case, the first step is to check whether pip is already available in your Python version.

How to check whether pip is already installed

Checking pip in Python takes only a few seconds and shows whether the issue is really a missing installation. Open Terminal, PowerShell, or Command Prompt and run one of these commands:

  • python -m pip –version
  • python3 -m pip –version
  • pip –version

If a version number appears, pip is already installed. If you get an error, try another command with python or python3, because different systems may point those commands to different Python installations.

If none of the commands work, move on to installation through the built-in ensurepip module or reinstall Python from the official distribution.

How to install pip in Python with ensurepip

Installing pip in Python with ensurepip is the safest and simplest option if the module is included in your build. Run one of these commands:

  • python -m ensurepip –upgrade
  • python3 -m ensurepip –upgrade

When the command finishes, check the version again with python -m pip –version. If a version appears, pip is ready to use.

If ensurepip cannot find the module or ends with an error, the Python installation is usually incomplete or built without the required components. In that case, reinstalling Python from the official site is usually the fastest fix, and it is worth making sure that the option to add Python to PATH is enabled during setup.

How to install pip on Windows, macOS, and Linux

Installing pip in Python differs by operating system, but the logic is the same: check whether it is already present, then use Python’s built-in tools. In practice, the process looks like this.

Windows

On Windows, pip is usually installed together with Python if you downloaded the installer from the official source. If the command does not work, open PowerShell or Command Prompt and run:

  • py -m ensurepip –upgrade
  • py -m pip –version

If the py command is not found, check whether Python was added to the PATH environment variable. After that, repeat the version check. If pip still does not run, reinstalling Python and selecting Add Python to PATH usually solves the problem.

macOS

On macOS, pip is often available through python3. Open Terminal and try:

  • python3 -m ensurepip –upgrade
  • python3 -m pip –version

If Python was installed through Homebrew, make sure the version you are using is the same one your project expects. After installation, it is a good idea to update pip right away with python3 -m pip install –upgrade pip so older package issues do not get in the way.

Linux

On Linux, pip may be missing from a minimal Python installation. Start by checking the Python version, then run:

  • python3 -m ensurepip –upgrade
  • python3 -m pip –version

Some distributions install pip through the system package manager, but for separate projects it is safer to use python3 -m pip so system packages and local packages do not get mixed together. If the command still fails, check whether the python3-pip package is installed in your distribution.

What to do after installation

After installing pip in Python, verify that it works in the environment you actually plan to use. The command python -m pip –version should show both the version number and the installation path. If that is not the Python you expected, your system has multiple versions, and you need to call the correct one explicitly.

The next useful step is to update pip:

  • python -m pip install –upgrade pip

After the update, check the version again. If the command fails with a permissions error, run the terminal as administrator or use a virtual environment so you do not change system packages.

For projects, it is better to create a virtual environment right away. That keeps dependencies separate for each project and avoids conflicts between libraries.

Common pip errors and a quick check

The most common pip problems in Python are usually caused by the wrong command or by having more than one Python version installed. If the command does not work, check three things:

  • whether you are using python, python3, or py in the correct shell;
  • whether Python is in PATH;
  • whether an older Python version is intercepting the command.

The quick test is simple: if python -m pip –version shows a version, pip is installed and working. If not, fix the Python path first, then reinstall components only if needed. That is safer than removing a working installation unnecessarily.