Upgrade pip python windows

Last Updated :
14 Aug, 2024

In this tutorial, we will see how to Upgrade PIP on Windows. We will cover how to upgrade, check the version, and also how to downgrade PIP to the previous version.

What does pip () do?

PIP is a package management system used to install and manage software packages/libraries written in Python. These files are stored in a large “online repository” termed as Python Package Index (PyPI). pip uses PyPI as the default source for packages and their dependencies. So whenever you type:

pip install package_name

pip will look for that package on PyPI and if found, it will download and install the package on your local system. Here, we will the focus on the following topics:

  • Upgrade PIP on Windows
  • Check the current version of PIP
  • Downgrade PIP to previous version

Note: If your system is not recognising PIP, downloaded using this article PIP.

Upgrade PIP on Windows

In order to upgrade PIP on Windows, just open the Window’s Command Prompt and type the following command:

python -m pip install --upgrade pip

Note that this command will only work if you have already added Python to Window Path.

Upgrade and Managing Multiple Python Versions

If you want to update specific version of Python of your machine, You can follow the below steps:

Step 1: Type Command Prompt in Window’s search box

Step 2: Open the Command Prompt and you will see the following screen.

C:\Users\Shivang>

Step 3: Type «cd» in the Command Prompt to ensure that your starting point has only the drive name:

C:\Users\Shivang>cd\

Step 4: Now press Enter and you will see the following screen.

C:\>

Step 5: Locate your original Python Application path ( the folder in which you originally installed Python ).

C:\Users\Shivang\AppData\Local\Programs\Python\Python39

Step 6: After retrieving the original Python Application Path, type «cd» followed by your Python Application Path:

C:\>cd C:\Users\Shivang\AppData\Local\Programs\Python\Python39

Step 7: Press Enter and then type this following command in your Command Prompt window:

python -m pip install --upgrade pip

For example,

 C:\Users\Shivang\AppData\Local\Programs\Python\Python39>python -m pip install ––upgrade pip

Step 8: You will notice that the latest PIP version is installed

Check the Version of PIP

To check the current version of PIP, just type/copy the following command in your Command Prompt:

pip --version

Downgrade PIP

In previous section, we have covered how to upgrade and check the version of PIP in Windows. But what if you like to revert back to a previous version of PIP? You can easily downgrade your Window’s PIP version to it’s previous version. How ? let’s see,

To downgrade the PIP version just type the following command:

python -m pip install pip==version_name

Suppose you wanted to downgrade your PIP version to 18.1 then,

python -m pip install pip==18.1

You will see the version of PIP that you wanted to install is installed.

Successfully installed pip-18.1

View this page

Toggle table of contents sidebar

Usually, pip is automatically installed if you are:

  • working in a
    virtual environment

  • using Python downloaded from python.org

  • using Python that has not been modified by a redistributor to remove
    ensurepip

Supported Methods¶

If your Python environment does not have pip installed, there are 2 mechanisms
to install pip supported directly by pip’s maintainers:

  • ensurepip

  • get-pip.py

ensurepip

Python comes with an ensurepip module[1], which can install pip in
a Python environment.

Linux

$ python -m ensurepip --upgrade

MacOS

$ python -m ensurepip --upgrade

Windows

C:> py -m ensurepip --upgrade

More details about how ensurepip works and how it can be used, is
available in the standard library documentation.

get-pip.py

This is a Python script that uses some bootstrapping logic to install
pip.

  • Download the script, from https://bootstrap.pypa.io/get-pip.py.

  • Open a terminal/command prompt, cd to the folder containing the
    get-pip.py file and run:

More details about this script can be found in pypa/get-pip’s README.

Standalone zip application¶

Note

The zip application is currently experimental. We test that pip runs correctly
in this form, but it is possible that there could be issues in some situations.
We will accept bug reports in such cases, but for now the zip application should
not be used in production environments.

In addition to installing pip in your environment, pip is available as a
standalone zip application.
This can be downloaded from https://bootstrap.pypa.io/pip/pip.pyz. There are
also zip applications for specific pip versions, named pip-X.Y.Z.pyz.

The zip application can be run using any supported version of Python:

If run directly:

Linux

$ chmod +x ./pip.pyz
$ ./pip.pyz

then the currently active Python interpreter will be used.

MacOS

$ chmod +x ./pip.pyz
$ ./pip.pyz

then the currently active Python interpreter will be used.

Windows

then the currently active Python interpreter will be used.

You may need to configure your system to recognise the .pyz extension
before this will work.

Alternative Methods¶

Depending on how you installed Python, there might be other mechanisms
available to you for installing pip such as
using Linux package managers.

These mechanisms are provided by redistributors of pip, who may have modified
pip to change its behaviour. This has been a frequent source of user confusion,
since it causes a mismatch between documented behaviour in this documentation
and how pip works after those modifications.

If you face issues when using Python and pip installed using these mechanisms,
it is recommended to request for support from the relevant provider (eg: Linux
distro community, cloud provider support channels, etc).

Upgrading pip

Upgrade your pip by running:

Linux

$ python -m pip install --upgrade pip

MacOS

$ python -m pip install --upgrade pip

Windows

C:> py -m pip install --upgrade pip

Compatibility¶

The current version of pip works on:

  • Windows, Linux and macOS.

  • CPython 3.9, 3.10, 3.11, 3.12, 3.13, and latest PyPy3.

pip is tested to work on the latest patch version of the Python interpreter,
for each of the minor versions listed above. Previous patch versions are
supported on a best effort approach.

Other operating systems and Python versions are not supported by pip’s
maintainers.

Users who are on unsupported platforms should be aware that if they hit issues, they may have to resolve them for themselves. If they received pip from a source which provides support for their platform, they should request pip support from that source.


Зачастую возникает необходимость обновления PIP. В данном руководстве будет дана поэтапная инструкция для обновления PIP в Windows.

Содержание статьи

  • План обновления PIP в Windows
  • Проверка текущей версии PIP
  • Инструмент для обновления PIP в Windows
  • Как вернуться к предыдущей версии PIP

Столкнуться с необходимостью обновления PIP можно при установке любого пакета, используя PIP.

Выводится следующее сообщение:

обновление pip

Вы используете версию pip 19.3.1; однако, доступна версия 20.1.1. Вам стоит сделать обновление через команду ‘python -m pip install –upgrade pip’.

Есть вопросы по Python?

На нашем форуме вы можете задать любой вопрос и получить ответ от всего нашего сообщества!

Telegram Чат & Канал

Вступите в наш дружный чат по Python и начните общение с единомышленниками! Станьте частью большого сообщества!

Паблик VK

Одно из самых больших сообществ по Python в социальной сети ВК. Видео уроки и книги для вас!

Для обновления PIP в Windows нужно открыть Windows Command Prompt, а затем набрать/скопировать туда указанную команду. Обратите внимание, что данный метод сработает только если у вас уже добавлен Python в Windows PATH. Ничего страшного, если вы не знаете, что это такое. Далее мы подробно разберем все шаги обновления PIP.

python m pip install upgrade pip

В поисковике Windows наберите Command Prompt (Командная строка):

Затем откройте Command Prompt (Командную строку). Во избежание проблем с уровнем доступа сделайте это от имени администратора. Для этого кликлинте правой кнопкой мыши и выберите пункт Run as administrator (Запустить от имени администратора):

В командной строке наберите cd \, чтобы удостовериться, что в начальной точке только название диска:

командная строка windows

Нажмите Enter. Вы увидите название диска C:\>

командная строка windows

Найдите путь к Python, что является папкой, куда установлен Python.

В нашем случае путь приложения Python следующий:

C:\Users\Ron\AppData\Local\Programs\Python\Python37-32

путь python

После получения пути к Python наберите следующую команду в командной строке: cd, за которым следует путь к приложению Python.

В нашем случае это выглядит следующим образом:

командная строка windows

Нажмите Enter, вы увидите:

командная строка windows

Обновите PIP, использовав данную команду, затем нажмите Enter:

python m pip install upgrade pip

В командной строке команда будет выглядеть следующим образом:

командная строка windows

Обратите внимание, что будет установлена последняя версия PIP:

командная строка windows

Проверка текущей версии PIP

Для проверки текущей версии PIP нужно использовать путь скриптов Python вместо пути приложения.

Наберите cd\, чтобы убедиться, что стартовой точкой является только название диска:

командная строка windows

Затем найдите путь к Python скриптов. Папка скриптов должна находиться внутри пути приложения Pythоn.

В нашем случае путь Python скриптов следующий:

C:\Users\Ron\AppData\Local\Programs\Python\Python37-32\Scripts

путь скриптов python

Затем наберите cd, после которой следует путь к Python скриптам, и нажмите Enter.

командная строка windows

В конечном итоге наберите следующую команду для проверки версии PIP:

командная строка windows

Нажмите Enter, после этого будет показана версия PIP.

командная строка windows

Разберем простой инструмент для обновления PIP.

Обратите внимание, что вам нужно добавить Python к Windows PATH для использования данного инструмента.

Далее дан полный код Python для инструмента обновления PIP используя Tkinter:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

import os

import tkinter as tk

root= tk.Tk()

canvas1 = tk.Canvas(root, width = 300, height = 350, bg = ‘lightsteelblue2’, relief = ‘raised’)

canvas1.pack()

label1 = tk.Label(root, text=‘Upgrade PIP’, bg = ‘lightsteelblue2’)

label1.config(font=(‘helvetica’, 20))

canvas1.create_window(150, 80, window=label1)

def upgradePIP ():

    os.system(‘start cmd /k python.exe -m pip install —upgrade pip’)

button1 = tk.Button(text=‘      Upgrade PIP     ‘, command=upgradePIP, bg=‘green’, fg=‘white’, font=(‘helvetica’, 12, ‘bold’))

canvas1.create_window(150, 180, window=button1)

root.mainloop()

Просто запустите код и затем нажмите на кнопку Upgrade PIP, после чего команда выполнится.

Что, если нужно откатиться к предыдущей версии PIP?

Выполнив следующие шаги, вернуться к предыдущей версии PIP не составит особого труда.

Как вернуться к предыдущей версии PIP

Перейдите в папку где установлен Python. Если сейчас настроен путь к скриптам, тогда просто наберите cd .. (и затем нажмите Enter), и вы вернетесь к папке с установленным Python.

командная строка windows

Предположим, нам нужно вернуться к версии 18.1.

Для этого просто наберите следующую команду и затем нажмите Enter:

python m pip install pip==18.1

Вы должны увидеть указанную версию PIP:

командная строка windows

Являюсь администратором нескольких порталов по обучению языков программирования Python, Golang и Kotlin. В составе небольшой команды единомышленников, мы занимаемся популяризацией языков программирования на русскоязычную аудиторию. Большая часть статей была адаптирована нами на русский язык и распространяется бесплатно.

E-mail: vasile.buldumac@ati.utm.md

Образование
Universitatea Tehnică a Moldovei (utm.md)

  • 2014 — 2018 Технический Университет Молдовы, ИТ-Инженер. Тема дипломной работы «Автоматизация покупки и продажи криптовалюты используя технический анализ»
  • 2018 — 2020 Технический Университет Молдовы, Магистр, Магистерская диссертация «Идентификация человека в киберпространстве по фотографии лица»

Download Article

Keep your Python environment up-to-date with this simple guide

Download Article

  • Using Python
  • |

  • Using Install Script
  • |

  • Using Python Installer
  • |

  • Using Apt & DNF
  • |

  • Using Homebrew
  • |

  • Video
  • |

  • Tips

If you haven’t updated Pip, the Python package manager, in a while, you might be using an outdated version. The easiest way to update Pip is to do so from within Python. If you also need to upgrade Python, installing the latest version of Python will also get the most up-to-date version of Pip. Whether you use Terminal/Command Prompt commands, the Python installer, or a package manager, it’s easy to update Pip on Windows, macOS, and Linux. We’ll show you how, plus give you helpful troubleshooting tips along the way.

Things You Should Know

  • If you’re using Python 3.4 or later, you can update Pip using the command python -m pip install --upgrade pip.
  • To check your Pip version, use pip3 -V (Python 3) or pip2 -V (Python 2).
  • If you want to update Python in addition to Pip, you can do so by downloading the installer, using Homebrew, or your Linux distribution’s package manager.
  1. Step 1 Open a Terminal or Command Prompt window.

    The most straightforward way to update Pip is from the command line. Because Python 3.4 and later comes with Pip, you can easily update it without downloading a new package.[1]

    • Mac: Type Terminal in Launchpad and select Terminal.[2]
    • Linux: Press Ctrl + Alt + T or click Terminal in your app list.
    • Windows: Type command prompt into the Windows search bar and click Command Prompt.[3]
  2. Step 2 Check the current Pip version (optional).

    Run the command pip -V to see which version of Pip is installed. This command will print the version number to the terminal.

    • If you have both Python 2 and Python 3 installed, the pip command may evoke Python 2 instead of the latest version. Use pip3 -V to check the version of Pip for Python 3, and pip2 -V to check for Python 2.
    • If you’re using Python 3.4 or earlier, Pip may not be installed. In this case, use python -m ensurepip --upgrade to install it now.
    • If you’re using Windows and get the error «pip is not recognized as an internal or external command,» make sure you’ve installed Python. If you have installed Python and get this error, you’ll need to add Python to your Windows path and then relaunch Command Prompt. To learn how, see Adding the Python Path to Windows.

    Advertisement

  3. Step 3 Run the command python -m pip install --upgrade pip to update Pip.

    If this command doesn’t work on Windows, use py -m pip install --upgrade pip instead.

    • If you get permissions errors in Linux, run sudo python -m pip install --upgrade pip.
    • If you have both Python 2 and Python 3, update Pip for each version separately:[4]

      • python3 -m pip install --upgrade pip
      • python2 -m pip install --upgrade pip
  4. Advertisement

  1. Step 1 Open a Terminal or Command Prompt window.

    If you’re using a version of Python 3 older than Python 3.4, you can use a script to install the latest version of Pip. This method will not work for deprecated versions of Python, including Python 2.[5]

    • Mac: Type Terminal into Spotlight search and select Terminal.
    • Linux: Press Ctrl + Alt + T or click Terminal in your app list.[6]
    • Windows: Type command prompt into the Windows search bar and click Command Prompt.[7]
  2. Step 2 Download the script file.

    You can do this easily using curl on any operating system, as it’s preinstalled. Just run the command curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py at the prompt and wait for the script to download.[8]

  3. Step 3 Install the latest version of Pip.

    To do so, run the downloaded script using the command python3 get-pip.py. This installs the latest version of Pip for Python 3.

  4. Step 4 Check your Pip version.

    In the Terminal or Command Prompt window, run the command pip3 -v

  5. Advertisement

  1. Step 1 Check your current Python version.

    If you want to update both Python and Pip, you can download and install the latest version of Python. Before you do this, make sure you’re not already using the latest version. To check, open Command Prompt or Terminal and run python --version.[9]

    • Only use this method if you want to update Python as well as Pip. If Python is already up to date on your PC or Mac, update pip via Python instead.
    • If the version number starts with 2 instead of 3, run python3 --version to see if Python 3 is also installed and find the version number.
  2. Step 2 Find the latest...

    Find the latest version at https://www.python.org/downloads. Compare your version of Python to the version in the yellow «Download Python» button at the top of the page.

  3. Step 3 Download the Python installer.

    If you’re using an older Python version than the latest release, click the yellow Download button to download the latest installer.

  4. Step 4 Run the installer.

    Double-click the downloaded file and follow the on-screen instructions to install. Once Python is installed, you’ll have the latest version of Pip.

    • On Windows, make sure to check the box next to «Add python.exe to PATH» at the bottom of the installer to ensure you can run Python and Pip commands from any location.
  5. Step 5 Check your Pip version.

    In a new Command Prompt or Terminal window, run the command pip -v to check the Pip version.

    • If you have both Python 2 and Python 3, run pip3 -v to check the Pip version of Python 3.
  6. Advertisement

  1. Step 1 Open a Terminal window.

    You can do so on most Linux distributions by pressing Ctrl + Alt + T.[10]

    • Use this method if you want to update both Python and Pip at the same time.
  2. Step 2 Check your current Python version.

    If you’re already using the latest version of Python, there’s no need to use this method. Run the command python3 --version to check. Then, compare your version to the latest stable release at https://www.python.org/downloads.

  3. Step 3 Update your system's repository list.

    • Ubuntu and Debian: sudo apt update
    • CentOS, Fedora, Redhat: sudo dnf upgrade
  4. Step 4 Install Python 3 from your distro's package manager.

    Once you run the command to install the latest version of Python 3, Pip will also be upgraded.

    • Ubuntu and Debian: sudo apt install python3
    • CentOS, Fedora, Redhat: sudo dnf install python3.
  5. Advertisement

  1. Step 1 Open a Terminal window.

    You can update both Python and Pip using Homebrew if you prefer. You should only use this method if you need to upgrade Python as well as Pip.

    • Before you continue, make sure Homebrew is installed. To check, type brew -v and press Return. If the command is not found, you’ll need to install Homebrew using this command: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"[11]
    • To check your Python version, run the command python3 --version. Compare your version to the latest stable release available from https://www.python.org/downloads/macos/.
    • If the command is not found, Python 3 is not installed. Continue with this method to install it.
  2. Step 2 Run the command brew install pyenv.

    This command installs a library that can help you manage your Python versions.

  3. Step 3 Run the command pyenv install -l to view all versions of Python.

    To make sure you’re getting the latest version of Python (and the latest version of pip), you can run this command to find the most recent version number.

  4. Step 4 Run the command pyenv install version-number.

    For example, to install Python 3.11.5, you’d type pyenv install 3.11.5 and press Return. This installs the latest version of Python 3 and pip.[12]

    • Now that you have the latest pip version, you can update it in the future using the command python3 -m pip install --upgrade pip.
  5. Advertisement

Ask a Question

200 characters left

Include your email address to get a message when this question is answered.

Submit

Advertisement

Video

  • If you’re using Linux, avoid using sudo to install Python packages. If you install a package that contains malicious code with root permissions, you risk giving the attacker unrestricted access to your system.

Thanks for submitting a tip for review!

Advertisement

About This Article

Thanks to all authors for creating a page that has been read 150,515 times.

Is this article up to date?

Pip Upgrade – And How to Update Pip and Python

Python is a widely used and powerful programming language that’s relatively simple to learn.

Python releases patch updates every few months and major updates around once in a year. Because of this, it is always a good idea to update the version of Python you have on your computer.

In addition, you need to update Python so you can get access to the exciting features they add after major updates. For example, there’s quite a speed improvement in Python 3.11 over 3.10.

There’s also a Python package manager called Pip you might need to update occasionally. It is to Python what NPM is to JavaScript.

Starting from Python 3.4, Pip comes with the standard Python distribution. But if you don’t get it after installing Python for some reason, then you need to install it manually.

In this article, I will show you how to update Python on your Mac and Windows computer. I will also show you how to update Pip on the two operating systems.

What We’ll Cover

  • How to Update Python and Pip on Mac OS
  • How to Update Python and Pip with Homebrew
  • How to Update Only Pip with the Terminal
  • Conclusion

One of the easiest ways to update Python and Pip on Mac is by downloading the package from the Python official website.

When you update Python, the Pip version that comes with it is also updated.

First, check the versions of Python and Pip you have by running python3 --version and pip3 --version:

Screenshot-2023-03-14-at-11.57.29

Go to https://www.python.org/downloads/macos/ and select the release you want:

Screenshot-2023-03-14-at-12.16.47

For me, I picked 3.11 because it’s now stable.

Scroll down and download it for your OS – be it Windows or Mac. I chose Mac becuase I use Mac:

Screenshot-2023-03-14-at-12.18.09

Run the installer and follow every prompt you see.

Screenshot-2023-03-14-at-12.19.43

Confirm the installation by running python3 --version and pip3 --version:

Screenshot-2023-03-14-at-12.21.47

How to Update Python and Pip with Homebrew

If you use Mac, you can also update Python and Pip with Homebrew.

Install pyenv by running brew install pyenv. pyenv is a Python version management tool. It is to Python what NVM (Node version manager) is to JavaScript.

Screenshot-2023-03-14-at-13.29.50

Install any version of Python you want, for instance, 3.9 or 2.7:

Screenshot-2023-03-14-at-13.49.26

You can also update Python by running pyenv latest-version-number. For example, python 3.11. When you install that Python version, you install Pip too.

How to Update Only Pip with the Terminal

In cases when you want to update only Pip, open your terminal and run pip3 install --upgrade pip. You can then confirm the update by running pip3 --version:

Screenshot-2023-03-14-at-13.02.02

Conclusion

This article took you through how to update Python and Pip by downloading the installation package and using the command line. We also looked at how you can update Pip only if you want to.

If you are using Windows and you want to update Python and Pip, you can also download the latest installer and let the installation wizard guide you through installing it.

Thanks for reading!



Learn to code for free. freeCodeCamp’s open source curriculum has helped more than 40,000 people get jobs as developers. Get started

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Как найти jdk на windows 10
  • Free ssh server windows
  • Как активировать windows 10 с помощью консоли
  • Business или consumer windows 10 какую ставить
  • Windows 10 мышь сама двигается