Обновление python через командную строку windows

In this article we are going to see how to update Python in the Windows system. For the sake of example we will be upgrading from Python 3.6.8 to Python 3.9.6. To check the current version of python on your system use the following command in the command prompt python

Improve Article

Save Article

  • Read
  • Discuss
  • Improve Article

    Save Article

    In this article, we are going to see how to update Python in the Windows system. For the sake of example, we will be upgrading from Python 3.6.8 to Python 3.9.6.

    To check the current version of python on your system, use the following command in the command prompt:

    python -V

    This will show you your current python version as shown below:

    Using the executable installer:

    Follow the below steps to update your python version:

    Step 1: Go to Python’s official site.

    Step 2: Click on the Downloads tab.

    Here you will get a list of available releases.

    Step 3: Download the version you need to upgrade to based on your system specifications(ie, 32-bit or 64-bit). Here we will be downloading the 64-bit installer for 3.9.6.

    Step 4: Click on the installer and it will begin the installation. Make sure to select the “Add Python 3.9 to PATH” option. and click on “Install Now”.

    This will start the installation as shown below:

    After the installation is successful you will get the following message:

    Now if you open up your cmd and use the below command:

    python -V

    You’ll see your version of Python has been updated to 3.9.6 as shown below:

    Improve Article

    Save Article

  • Read
  • Discuss
  • Improve Article

    Save Article

    In this article, we are going to see how to update Python in the Windows system. For the sake of example, we will be upgrading from Python 3.6.8 to Python 3.9.6.

    To check the current version of python on your system, use the following command in the command prompt:

    python -V

    This will show you your current python version as shown below:

    Using the executable installer:

    Follow the below steps to update your python version:

    Step 1: Go to Python’s official site.

    Step 2: Click on the Downloads tab.

    Here you will get a list of available releases.

    Step 3: Download the version you need to upgrade to based on your system specifications(ie, 32-bit or 64-bit). Here we will be downloading the 64-bit installer for 3.9.6.

    Step 4: Click on the installer and it will begin the installation. Make sure to select the “Add Python 3.9 to PATH” option. and click on “Install Now”.

    This will start the installation as shown below:

    After the installation is successful you will get the following message:

    Now if you open up your cmd and use the below command:

    python -V

    You’ll see your version of Python has been updated to 3.9.6 as shown below:

    How to Update Python Version? - [Upgrade Python Version]

    List of content you will read in this article:

    • 1. What is PIP?
    • 2. How to update Python on Windows Operating System?
    • 3. How To Upgrade Python on macOS?
    • 4. How to Update Python version on LINUX?
    • 5. Conclusion
    • 6. FAQ

    Python is an open-source high-level programming language that allows users to execute commands, plugins on their machine, and even software from several major suppliers. It means you can operate it on many different operating systems, including the Windows VPS Server. Python is a cross-platform programing language.

    Pip is one of the best applications for Python package installation and administration. Pip’s popularity stems from the many apps that use this tool. Pip enables 3rd Party package installed to manage binary packages with the quickly configured package manager. Since Python’s latest releases have piping as normal, this guide will explain how to install PIP and how to update Python version with a complete step-by-step guide.

    What is PIP?

    PIP is a software management framework for installing and managing Python-written program packages. It is called the ‘preferred software installer’ or ‘Pip Installs Packages.’ PIP, used for Python, is a command-line interface for handling PyPI program installation. You might need to upgrade PIP if you’re using an earlier version of Python on Windows. Download the application file, open the command- line and start the installer to run PIP on Windows quickly. It will teach you how PIP is installed on Windows and how it can be modified, upgraded, and set up.

    How to update Python on Windows Operating System?

    There are two simple ways to update your current Python version with the latest one. They are as follows: 

    1. Using the Python Installer
    2. Using the Windows Chocolatey Package Manager

    So let’s see how we can update the Python version with these two methods, one by one.

    Method 1: Update the Version of Python on Windows using the Python Installer

    This method of updating the Python version will work if Python is installed or not on your System.

    If Python is already installed on your system, you can check it using the python -V command.

    Step 1: Download the Python installer from the Official Website of Python

    The easiest way to update the Python version is to download the latest version from the official website (https://www.python.org/downloads/)

    You can click on the Download Python 3.11.0 button, and it will download the latest compatible Python version for your system.

    Step 2: Install the Downloaded Python Installer

    After downloading the exe file, double-click on it to install Python.

    Step 3: Install Python

    Now, you can install the latest version of Python.

    Check the “Add python.ext to PATH”, then click on the “Install Now” button.

    This will start the installation process. 

    After processing, the latest version of Python will be installed on your system. 

    Click on the “Close” Button.

    Step 4: Verify the Update

    After successful installation, you can verify whether or not the latest version is installed on your system. To check the version, you can again run the same command, python -V, on the prompt command.

    Now, you can see that it is showing the latest installed version, i.e., Python 3.11.0.

    Note: If it still shows the old version, you may restart your system. Or uninstall the old version from the control panel.

    Method 2: Install Python using Command Line Only using the Chocolatey Package Manager

    Chocolatey is a Package Manager command line tool for windows, and we can use it to install software for our window system. In our case, we can use it to install Python or update the current version of Python.

    Step 1 Open The Powershell as Administrator

    To install Chocolatey, you need to open PowerShell as Administrator.

    Step 2: Install the Chocolatey Package Manager Command

    Now, you can install the Chocolatey package manager using the following command.

    Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

    Step 3: Verify the Chocolatey Installation

    Now, you need to check whether Chocolatey has been installed successfully. To check it, run the “choco” command.

    It is installed successfully because it is showing version Chocolatey v1.2.0.

    Step 4: Update Python with Chocolatey

    With the help of the choco upgrade command, we can update our current Python version.

    choco upgrade python -y

    Step 5: Verify the Version

    You can again check the latest installed Python version using the following command.

    python -V

    Note: The old version of Python will remain on your system. You can uninstall the old version from the control panel.

    How To Upgrade Python on macOS?

    You can download the latest version of Python for macOS from the official Python website, similar to what you did on windows OS to update Python version on your system. To check whether it is updated to the lasted version or not, follow the below-listed commands to check the Python version.

    $ python --version

    Python 2.x.x

    $ python3 --version

    Python 3.9.0

    If you want to execute this new Python release with the python command instead of python3, install an alias in your $HOME directory’s bash profile file.

    Open the terminal window and type the following commands:

    $ cd $HOME
    $ nano .bash_profile

    Then, at the bottom, add this segment.

    alias python="python3"

    Python 3.9 version can be checked using the following command.

    $ python --version

    Python 3.9.0

    How to Update Python version on LINUX?

    Users can use the below listed Linux commands to upgrade Python version on the Linux server:

    ppa:deadsnakes/ppa can be added to the system’s Software Sources to upgrade the machine with unsupported packages from this untrusted PPA.

    $ sudo add-apt-repository ppa:deadsnakes/ppa

    This command is used to update the Python package.

    $ sudo apt update
    $ sudo apt install python3.9

    Then, using the commands below, you can search the versions of your new and current Python installations:

    This command will show you the following version of python installed in your system

    $ sudo python --version

    2.x.x

    $ sudo python3 --version

    3.8.x

    $ sudo python3.9 --version

    3.9.0

    Conclusion

    We have seen how to update Python version on operating systems like Windows, Mac OS, and Linux. Follow the guide carefully to update your python software. We believe this guide fulfills your requirement though you can install the latest version successfully. Leave your comments below for your feedback and queries.

    People Are Also Reading:

    • How to Learn Python
    • How to Install Python on Windows
    • How to Install Python on Ubuntu
    • How to Check Python Version?

    Installing/Upgrading Python Using the Chocolatey Windows Package Manager

    Let’s say you have Python 2.7.16:

    C:Windowssystem32>python --version
    python2 2.7.16
    

    …and you want to upgrade to the (now current) 3.x.y version. There is a simple way to install a parallel installation of Python 3.x.y using a Windows package management tool.

    Now that modern Windows has package management, just like Debian Linux distributions have apt-get, and RedHat has dnf: we can put it to work for us! It’s called Chocolatey.

    What’s Chocolatey?

    Chocolatey is a scriptable, command line tool that is based on .NET 4.0 and the nuget package manager baked into Visual Studio.

    If you want to learn about Chocolatey and why to use it, which some here reading this might find particularly useful, go to https://chocolatey.org/docs/why

    Installing Chocolatey

    To get the Chocolatey Package Manager, you follow a process that is described at https://chocolatey.org/docs/installation#installing-chocolatey,

    I’ll summarize it for you here. There are basically two options: using the cmd prompt, or using the PowerShell prompt.

    CMD Prompt Chocolatey Installation

    Launch an administrative command prompt. On Windows 10, to do this:

    • Windows + R
    • Type cmd
    • Press Ctrl + ⇧ Shift + ↵ Return

    If you don’t have administrator rights on the system, go to the Chocolatey website. You may not be completely out of luck and can perform a limited local install, but I won’t cover that here.

    • Copy the string below into your command prompt and type Enter:
    @"%SystemRoot%System32WindowsPowerShellv1.0powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%chocolateybin"
    

    Chocolatey will be downloaded and installed for you as below:

    Getting latest version of the Chocolatey package for download.
    Getting Chocolatey from https://chocolatey.org/api/v2/package/chocolatey/0.10.11.
    Downloading 7-Zip commandline tool prior to extraction.
    Extracting C:UsersblahblahblahAppDataLocalTempchocolateychocInstallchocolatey.zip to C:UsersblahblahblahAppDataLocalTempchocolateychocInstall...
    Installing chocolatey on this machine
    Creating ChocolateyInstall as an environment variable (targeting 'Machine')
      Setting ChocolateyInstall to 'C:ProgramDatachocolatey'
    WARNING: It's very likely you will need to close and reopen your shell
      before you can use choco.
    Restricting write permissions to Administrators
    We are setting up the Chocolatey package repository.
    The packages themselves go to 'C:ProgramDatachocolateylib'
      (i.e. C:ProgramDatachocolateylibyourPackageName).
    A shim file for the command line goes to 'C:ProgramDatachocolateybin'
      and points to an executable in 'C:ProgramDatachocolateylibyourPackageName'.
    
    Creating Chocolatey folders if they do not already exist.
    
    WARNING: You can safely ignore errors related to missing log files when
      upgrading from a version of Chocolatey less than 0.9.9.
      'Batch file could not be found' is also safe to ignore.
      'The system cannot find the file specified' - also safe.
    chocolatey.nupkg file not installed in lib.
     Attempting to locate it from bootstrapper.
    PATH environment variable does not have C:ProgramDatachocolateybin in it. Adding...
    WARNING: Not setting tab completion: Profile file does not exist at 'C:UsersblahblahblahDocumentsWindowsPowerShellMicrosoft.PowerShell_profile.ps1'.
    Chocolatey (choco.exe) is now ready.
    You can call choco from anywhere, command line or powershell by typing choco.
    Run choco /? for a list of functions.
    You may need to shut down and restart powershell and/or consoles
     first prior to using choco.
    Ensuring chocolatey commands are on the path
    Ensuring chocolatey.nupkg is in the lib folder
    

    Either Exit the CMD prompt or type the following command to reload the environment variables:

    refreshenv
    

    PowerShell Chocolatey Installation

    If you prefer PowerShell to the cmd prompt, you can do this directly from there, however you will have to tell PowerShell to run with a proper script execution policy to get it to work. On Windows 10, the simplest way I have found to do this is to type the following into the Cortana search bar next to the Windows button:

    PowerShell.exe
    

    Next, right click on the ‘Best Match’ choice in the menu that pops up and select ‘Run as Administrator’

    Now that you’re in PowerShell, hopefully running with Administrator privileges, execute the following to install Chocolatey:

    Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
    

    PowerShell will download Chocolatey for you and launch the installation. It only takes a few moments. It looks exactly like the CMD installation, save perhaps some fancy colored text.

    Either Exit PowerShell or type the following command to reload the environment variables:

    refreshenv
    

    Upgrading Python

    The choco command is the same whether you use PowerShell or the cmd prompt. Launch your favorite using the instructions as above. I’ll use the administrator cmd prompt:

    C:WINDOWSsystem32>choco upgrade python -y
    

    Essentially, chocolatey will tell you «Hey, Python isn’t installed» since you’re coming from 2.7.x and it treats the 2.7 version as completely separate. It is only going to give you the most current version, 3.x.y (as of this writing, 3.7.2, but that will change in a few months):

    Chocolatey v0.10.11
    Upgrading the following packages:
    python
    By upgrading you accept licenses for the packages.
    python is not installed. Installing...
    
    python3 v3.x.y [Approved]
    python3 package files upgrade completed. Performing other installation steps.
    Installing 64-bit python3...
    python3 has been installed.
    Installed to: 'C:Python37' 
      python3 can be automatically uninstalled.
    Environment Vars (like PATH) have changed. Close/reopen your shell to
     see the changes (or in powershell/cmd.exe just type `refreshenv`).
     The upgrade of python3 was successful.
      Software installed as 'exe', install location is likely default.
    
    python v3.x.y [Approved]
    python package files upgrade completed. Performing other installation steps.
     The upgrade of python was successful.
      Software install location not explicitly set, could be in package or
      default install location if installer.
    
    Chocolatey upgraded 2/2 packages.
     See the log for details (C:ProgramDatachocolateylogschocolatey.log).
    

    Either exit out of the cmd/Powershell prompt and re-enter it, or use refreshenv then type py —version

    C:WindowsSystem32>refreshenv
    Refreshing environment variables from registry for cmd.exe. Please wait...Finished..
    
    C:Windowssystem32>py --version
    Python 3.7.2
    

    Note that the most recent Python install will now take over when you type Python at the command line. You can run either version by using the following commands:

    py -2
    Python 2.7.16 (v2.7.16:413a49145e, Mar  4 2019, 01:37:19) [MSC v.1500 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> exit()
    
    C:>py -3
    Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>>exit()
    C:>
    

    From here I suggest you use the Python pip utility to install whatever packages you need. For example, let’s say you wanted to install Flask. The commands below first upgrade pip, then install Flask

    C:>py -3 -m pip install --upgrade pip
    Collecting pip
      Downloading https://files.pythonhosted.org/packages/d8/f3/413bab4ff08e1fc4828dfc59996d721917df8e8583ea85385d51125dceff/pip-19.0.3-py2.py3-none-any.whl (1.4MB)
        100% |████████████████████████████████| 1.4MB 1.6MB/s
    Installing collected packages: pip
      Found existing installation: pip 18.1
        Uninstalling pip-18.1:
          Successfully uninstalled pip-18.1
    Successfully installed pip-19.0.3
    
    c:>py -3 -m pip install Flask
    

    …will do the trick. Happy Pythoning!

    Python-сообщество

    Совершенно случайно узнал, что таким способом можно обновлять устанвленные пакеты Не надо ничего ручками скачивать и ставить ручками..

    python -m pip install —upgrade pip

    pip install —upgrade beautifulsoup4

    Хорошо было бы и сам питом таким же образом обновлять

    #2 Фев. 10, 2016 22:46:41

    Можно обновлять питон через командную строку?

    Если новая версия будет в репозитории, то обновить питон можно как и все остальные программы, через sudo apt-get upgrade и тому подобное

    #3 Фев. 10, 2016 22:55:10

    Можно обновлять питон через командную строку?

    Sudo это касается линукс-машин? У меня вин32.. забыл указать.. сейчас подпись в профиле поправлю спасибо за отклик.

    #4 Фев. 11, 2016 06:42:43

    Можно обновлять питон через командную строку?

    newpy
    В виндоусе качаете msi или что там счаз за установочник и обновляете. Для Windows платформ ничего другого, более удобного, на данный момент не придумали.

    _________________________________________________________________________________
    полезный блог о python john16blog.blogspot.com

    #5 Фев. 11, 2016 08:16:36

    Можно обновлять питон через командную строку?

    • можно поставить виртуальную машину с юниксом.
    • можно поставить более простые эмуляторы unix cygwin, msys2
    • можно поставить поделку типа conda/miniconda

    Если вы задаетесь таким вопросом то это скорее всего первый шаг перед окончательным переходом на unix

    Обновление PIP для Python

    Как обновить pip

    PIP – утилита «Командной строки», предназначенная для работы с компонентами PyPI. Если данная программа инсталлирована на компьютере, это значительно облегчает процесс установки различных сторонних библиотек для языка программирования Python. Периодически рассматриваемый компонент обновляется, совершенствуется его код и добавляются нововведения. Далее мы рассмотрим процедуру обновления утилиты с помощью двух способов.

    Обновляем PIP для Python

    Система управления пакетами будет работать корректно только в том случае, когда используется ее стабильная версия. Периодически программные компоненты меняют свой вид, вследствие чего нуждается в обновлении и PIP. Давайте рассмотрим два разных метода инсталляции новой сборки, которые будут наиболее подходящими в определенных ситуациях.

    Способ 1: Загрузка новой версии Python

    PIP ставится на ПК вместе с Python, скачанным с официального сайта. Поэтому самым простым вариантом обновления будет скачивание самой свежей сборки Питон. Перед этим не обязательно удалять старую, новую можно поставить поверх или сохранить файлы в другом месте. Сначала мы рекомендуем убедиться в том, что установка свежей версии необходима. Для этого произведите следующие действия:

      Откройте окно «Выполнить» путем нажатия комбинации клавиш Win + R, впишите cmd и нажмите Enter.

    Открыть командную строку через Выполнить Windows 7

    Узнать версию установленого Python

    Процедура загрузки и распаковки новой версии происходит так:

    1. Перейдите на официальный сайт Python по ссылке выше или через поиск в любом удобном браузере.
    2. Выберите раздел «Downloads».

    Переход к скачиванию Python с официального сайта

    Переход к списку загрузок Python на официальном сайте

    Выбрать подходящую загрузку на официальном сайте Python

    Выбрать тип инсталлятора на официальном сайте Python

    Включить добавление переменных при установке Python

    Кастомная установка Python

    Установить pip во время инсталляции Python

    Дополнительные параметры установки Python

    Место установки Python

    Ожидание завершения инсталляции Python

    Уведомление об окончании установки Python

    Теперь команда PIP из системы управления пакетами с одноименным названием будет работать корректно со всеми дополнительными модулями и библиотеками. По завершении установки вы можете переходить к утилите и взаимодействовать с ней.

    Способ 2: Ручное обновление PIP

    Иногда метод с обновлением всего Python для получения свежей версии PIP не подходит по причине ненадобности выполнения этой процедуры. В таком случае мы рекомендуем загрузить компонент управления пакетами вручную, а затем внедрить его в программу и переходить к работе. Вам потребуется сделать всего несколько манипуляций:

    1. Перейдите на официальную страницу скачивания PIP по ссылке выше.
    2. Определитесь с подходящей версией из трех предложенных.

    Выбрать версию системы пакетов PIP

    Перейти к сохранению системы пакетов PIP

    Сохранить системы пакетов PIP

    Выбор места для сохранения системы пакетов PIP

    Свойства файла системы пакетов PIP

    Расположение файла системы пакетов PIP

    Открыть командную строку через Выполнить Windows 7

    Переход к месту хранения системы пакетов PIP

    Установить систему пакетов PIP

    Ожидание завершения установки системы пакетов PIP

    Окончание установки системы пакетов PIP

    На этом процесс обновления закончен. Вы можете смело пользоваться утилитой, загружать дополнительные модули и библиотеки. Однако если при вводе команд возникают ошибки, рекомендуем произвести следующие действия, а после снова зайти в «Командную строку» и начать инсталляцию PIP.

      Дело в том, что не всегда при распаковке Питон разных сборок происходит добавление системных переменных. Связано это чаще всего с невнимательностью пользователей. Для ручного создания этих данных сначала перейдите в меню «Пуск», где нажмите ПКМ на «Компьютер» и выберите пункт «Свойства».

    Свойства системы Windows 7

    Дополнительные параметры системы Windows 7

    Добавить переменную в Windows 7

    Добавить системную переменную в Windows 7

    Ввод названия и значения переменной в Windows 7

    Python№ — директория программы (Название меняется в зависимости от установленной версии).

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

    Альтернативный метод добавления библиотек

    Не у каждого юзера получается обновить PIP и пользоваться его встроенной утилитой для добавления модулей к Питон. К тому же не все версии программы корректно работают с данной системой. Поэтому мы предлагаем использовать альтернативный способ, который не требует предварительной инсталляции дополнительных компонентов. Вам нужно выполнить следующее:

      Перейдите на сайт загрузки модулей и скачайте их в виде архива.

    Пример загрузки модулей для Python

    Открыть директорию модулей для Python

    Свойства файла установки модулей для Python

    Расположение файла-модуля для Python

    Перейти к расположению файла модуля Python

    Python setup.py install

    Установить модули для Python

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

    Как видите, процесс обновления PIP довольно сложный, однако все получится, если следовать приведенным выше инструкциям. Если же утилита PIP не работает или не обновляется, мы предложили альтернативный метод установки библиотек, который в большинстве случаев функционирует корректно.

    ЗакрытьМы рады, что смогли помочь Вам в решении проблемы.
    ЗакрытьОпишите, что у вас не получилось. Наши специалисты постараются ответить максимально быстро.

    Помогла ли вам эта статья?
    Еще статьи по данной теме:

    Ваша статья очень помогла.
    Была проблема с обновлением pip.

    Здравствуйте, Сергей. Рады, что наши инструкции помогли решить Вашу проблему.

    У меня cmd ни одну из команд не хочет признавать командой

    2020_03_28_22_26_00_780

    Необходимо перейти к самому Python, а узнать где он лежит можно таким образом:
    1.Запустить Python IDLE
    2.Написать import os нажать Enter
    3.Написать os.getcwd() нажать Enter
    4.Всё вы знаете где находится Python

    Здравствуйте! не получается обновить pip. При вводе команды обновления, не обновляет и выдает одно и тоже сообщение.

    comment_image_reloaded_205268853

    Здравствуйте, нашли решение данной проблемы ?

    Ответить хтось или нет.

    Здравствуйте, аноним. Эта проблема относится к отсутствию прав доступа на внесение изменений в библиотеку, о чем и говорится в сообщении. Есть три решения данной проблемы:

    1. Запустите «Командную строку от имени администратора», после чего вводите команду для обновления версии.
    2. Используйте атрибут —user , чтобы установить новую версию в пользовательскую папку. Так вы обойдете ограничения на внесение изменений. Команда должна обрести следующий вид: -m pip install —upgrade pip —user .
    3. Перейдите по пути C:Program Files (x86) и найдите там каталог Python37. Щелкните по нему правой кнопкой мыши и через контекстное меню перейдите в «Свойства». Откройте вкладку «Безопасность» и предоставьте полный доступ, после чего сохраните изменения.

    Один из этих методов должен помочь решить проблему, поэтому используйте их по очереди, проверяя, как это сказывается на установке обновлений.

    Windows Command Line Python Change Version

    How can I run my python setup.py build/install on 2.6 instead?

    Many thanks in advance,

    6 Answers 6

    You can use explicit paths:

    Recent versions of Python install PyLauncher. It is installed in the path so no need to add an explicit Python to the path, and it allows easy switching between multiple Python versions.

    The default version can be specified in the environment variable PY_PYTHON , e.g. PY_PYTHON=3 (latest Python 3).

    user avatar

    It depends on your operating system. If you have python 2.6 installed, you need to change your environment path to point to the 2.6 executable rather than the 2.5 executable. Do a Google search for changing your PATH variable on your operating system.

    If you’re on Windows and you just need to run a different version of Python temporarily or, as was the case for me, a third party program needs to run a different version of Python, then modify your path at the command prompt:

    This allowed the third party program to install successfully. The PATH modification only affects programs running in the same command prompt session and only lasts as long as the command prompt session..

    They are a couple of ways you can do this 1) python virtual environment 2) pylauncher 3) Changing your windows path variable, tedious to say the least

    Introduction

    Every fresh Python release comes with bug fixes and new features. Python 3.9, the latest point release at the time of writing, comes with features such as improved time zone support, dictionary updates, and more flexible decorators.

    This tutorial shows you how to upgrade Python to version 3.9 on all the major operating systems — Windows, macOS, and Linux.

    How to Upgrade Python to 3.9

    Prerequisites

    • Administrative rights on the operating system you are using.
    • Knowledge of which Python version is currently on your system. If you need help finding out the version of your Python installation, check out How to Check Python Version.

    Note: If you are upgrading from a Python 2 release and do not have Python 3 installed, read our comprehensive guides on how to install it on:

    • Windows 10
    • Ubuntu 20.04
    • CentOS 8

    Upgrading Python on Windows OS

    To upgrade Python on Windows, download the installer or search for the app in the Microsoft Store.

    Upgrade to Python 3 with the Installer

    1. In your browser, visit the Python Releases for Windows section on the official Python website.

    2. Click the Download Python button to download the installation file on your computer.

    Downloading the newest version of Python for Windows

    3. Next, run the Python installer. If you are upgrading from another point release of Python 3 (for example, 3.8.10), the installer suggests to install Python 3.9. Select Install Now to install Python with recommended options, or select Customize Installation to pick the install location and features.

    Starting installation of Python 3 in Windows

    If you already have an older version of the same Python release (for example, 3.9.1), the installer offers to upgrade your Python installation. Proceed by selecting Upgrade Now.

    Starting the upgrade of Python 3 in Windows

    4. When the installation finishes, check whether the new version of Python has been installed successfully. Open Windows PowerShell and type:

    python3 --version

    The output should show the latest version of Python, as in the image below.

    Confirming the successful Python 3 installation in Windows

    Install Python 3.9 from the Microsoft Store

    If you want to use Python 3.9 to learn the basics or test some simple concepts, find and install the Python 3.9 app from the Microsoft Store.

    1. Go to Microsoft Store and type Python in the search field.

    2. Select Python 3.9 from the search results that appear.

    Searching for Python 3 in Microsoft Store

    3. Click the Get button to start the installation.

    Starting Python 3.9 installation in Microsoft Store

    Start the interactive Python 3.9 experience by finding the app in the Start Menu.

    Upgrading Python on macOS

    On macOS, Python can be installed, upgraded, and maintained using the command line interface or the GUI.

    Upgrade Python using Homebrew

    Install Python in the macOS terminal using the Homebrew package manager. If you do not have Homebrew, install it by typing the following script in the terminal:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

    Then, proceed with the steps:

    1. Update Homebrew by running:

    brew update

    2. If you are upgrading from Python 2, install Python 3 with the command:

    brew install python3

    If you already have a version of Python 3 installed, upgrade the package with the brew upgrade command:

    brew upgrade python3

    Upgrade Python with the Installer

    1. In your browser, navigate to the Python Releases for macOS page, on Python’s official website.

    2. Click the link to download the latest Python 3 release on your computer.

    Downloading the Python installer for macOS from the official website

    3. Run the installer. Go through the installation steps by clicking Continue, agreeing to the License, and confirming the installation location and type.

    Starting a Python 3.9 installation in Mac OS using the installer

    4. Once the installation is complete, select Close.

    The installer confirms the successful installation of Python 3.9 on MacOS

    5. Finally, confirm that the new Python version has been successfully installed by typing the following in terminal:

    python3 --version

    The output should display the latest version of Python.

    Checking the Python version in macOS

    Upgrading Python in Linux

    This article uses Ubuntu and its APT package manager to upgrade Python. If you are using a different Linux distribution, replace the apt Linux command with the appropriate command featured for your package manager.

    Warning: Many Linux systems have Python 2 installed as the system version. Removing Python 2 could cause a system error. If you are planning to install Python 3 on Linux, install it alongside Python 2 and invoke it with the python3 command.

    1. Start by updating the repositories:

    sudo apt update

    2. Next, install Python 3.9 by running:

    sudo apt install python3.9

    When prompted, type Y to start the installation.

    Installing Python 3.9 in Ubuntu with apt

    3. Once Python installs, invoke the 3.9 version by running:

    python3.9

    4. However, checking the installation with the python3 --version command still returns the old version. To fix this, you need to create a list of update alternatives. First, add the old version to the list with the command:

    sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.[old-version] 1
    

    5. Now add the new version:

    sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 2
    Adding Python 3.9 to update alternatives

    6. Next, type the following command to configure the priority status of the versions:

    sudo update-alternatives --config python3

    The output displays the available choices and their assigned number (in the example below, the numbers are 0, 1, 2). Type the number of the the version you wish to use and press Enter.

    Configuring update-alternatives for Python 3 in Ubuntu

    7. If you are not planning to use the old version of Python, remove the symlink that contained the previous Python 3 version with:

    sudo rm /usr/bin/python3
    

    8. Then, replace the symlink with the new version:

    sudo ln -s python3.9 /usr/bin/python3

    9. Now, check the default version:

    python3 --version

    The output should confirm the successful installation and setup of the latest available version.

    Confirming the successful change of Python 3 version in Ubuntu

    Why Should You Upgrade Python?

    Since Python 3 was not a backward-compatible release, for a long time Python 2 remained the version of choice for those who wanted a stable development environment. Some services like Google App Engine did not support Python 3 for a long time.

    However, given that the official support for the final Python 2.7 release has ended, upgrading to Python 3 is now strongly recommended. Python 3 is faster, and its syntax is more user-friendly.

    If you already work with Python 3, upgrading to the latest point release gives you all the security updates and bug fixes.

    Conclusion

    After reading this tutorial, you should know how to upgrade your Python 3 version on Windows, macOS, and Linux. If you want to learn more about Python, read our article on Python data types.

    Как обновить Python в Windows?

    На чтение 2 мин Просмотров 38.7к. Опубликовано 07.09.2020

    Подробно рассмотрим как правильно обновить язык программирования Python.

    Содержание

    1. Введение
    2. Узнаем текущую версию
    3. Скачиваем последнюю версию
    4. Установка
    5. Проверка установки
    6. Заключение

    Введение

    Технологии развиваются быстро, а языки программирования — это основной драйвер развития. Нередко выходят корректирующие релизы исправляющие найденные ошибки или версии с расширением функционала. Python в этом плане ничем не отличается от других языков программирования, но процесс его обновления не столь сложен, как может показаться сначала. Если у вас получится обновить один раз, вы уже не забудете как его повторить, потому что это не сложно и очень быстро. 

    Узнаем текущую версию

    Открываем пуск -> выполнить -> вводим команду cmd. В открывшемся окне пишем команду python —version и смотрим какая у нас версия.

    Командная строка Windows
    Командная строка Windows

    Скачиваем последнюю версию

    Переходим на официальный сайт www.python.org/downloads/ и скачиваем последнюю версию

    Раздел загрузок официального сайта Python.org
    Раздел загрузок официального сайта Python.org

    Нажимаем кнопочку Download Python и скачиваем дистрибутив

    Загрузка последней версии Python с помощью браузера Edge
    Загрузка последней версии Python с помощью браузера Edge

    Установка

    Так как у меня установлена уже последняя версия Python мне пришлось скачать beta версию для демонстрации процесса обновления. Не пугайтесь из за того, что на картинках другая версия, это не ошибка 🙂

    Запуск установочного пакета Python 3.9
    Запуск установочного пакета Python 3.9

    Ставим обязательно галочку перед пунктом Add Python 3.9 to PATH.

    Нажимаем Install Now и переходим далее.

    Обязательно предоставляем полные права приложению

    Запрос прав администратора для установки Python
    Запрос прав администратора для установки Python

    Дожидаемся окончания процесса установки и в конце нажимаем Close

    Завершение установки Python для Windows
    Завершение установки Python для Windows

    Проверка установки

    В самом начале я описал процесс сверки текущий версии Python. Нам сейчас это необходимо повторить, только предварительно перезапустив окно cmd.exe иначе запуститься python старой версии 🙂

    Заключение

    В этой статье мы рассмотрели процесс обновления языка программирования Python, прошли от первого до последнего шага и успешно завершили обновление.

    На это все. Поздравляю, теперь у вас установлена последняя версия Python.

    Егор Егоров

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

    Ссылка на мой github есть в шапке. Залетай.

    Every year Python launches a new version of itself to provide new and improved services to its users. With every update, Python launches new features and bug fixes. This article shows, How to update Python on different platforms?

    A section of the article also shows how to check the current Python version installed in the system.

    Check your Python version:

    Before updating Python, one should check if one already has the latest version of Python in the system. Let us now follow the steps provided in the subsequent section for fetching the Python version.

    For Windows

    Open the command prompt to check the Python version installed:

    1. Click the Windows key and search cmd.
    2. Open the command prompt, type python, and hit enter.

    Its version number shall appear after the phrase Python.

    For MAC

    Python comes pre-installed in the MAC operating system. If your computer has an old Python version, programmers can update it to the latest one following the process given here.

    For checking the Python version present in the system:

    1. Open the application folder ->Utilities folder->open the terminal.
    2. Once you open the terminal window, type the given command, and click the return key to confirm the version of Python.
    python --version 

    The above command shall show the Python’s version number that is installed in your computer.

    For Linux

    Python comes pre-installed in the Linux operating system. Before updating, it is crucial to check the Python version installed in the system.

    To check the Python version present in the system:

    1. Open the terminal window in Linux by simply clicking Ctrl + Alt + T
    2. Type the below command and hit the return key
    python --version

    This command will display the current Python version number installed in the system.

    Updating the Python for various platforms (MAC, Windows, and Linux)

    One can update Python by going to its official site and then downloading the latest version of Python available. One can also use the terminal or command prompt of the operating system to update Python.

    Update Python in Windows

    Updating Python is easy for Windows users.

    1. Go to the website of Python, and click on the Python download button
    2. After clicking the Python download button, downloading of the installation file shall begin
    3. Now run the installer, the installer will automatically suggest downloading the latest version of Python
    4. And, if the system has an old Python version, the installer will display an upgrade now button. Click the button to start the upgrading process.

    Update Python in MAC Systems

    One can update Python for MAC from Python’s official website. One can also update Python in MAC using Homebrew. You have to follow the steps provided in the subsequent section to update Python with Homebrew:

    First, one needs to have the Homebrew package manager in his system. To do that, one must download Homebrew from the Homebrew site. One can also download Homebrew by copying the below code into the terminal.

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

    Now to update Python, enter the below commands in the terminal:

    brew upgrade python3 #(old Python version number)

    Update Python in Linux Systems

    If the system doesn’t have the latest version of Python, one can update the Python by copying the below commands to the terminal:

    sudo apt update
    sudo apt install software-properties-common

    The above command will install all the essential packages required to install the latest version of Python.

    Conclusion:

    Every year Python launches a new version to provide new and improved services to its users. This article is about installing the latest and updated Python’s version. One can follow the above steps to check if Python’s latest version is already present in the system. Knowing that will surely save a lot of time and effort.

    Содержание

    1. Как обновить pip через командную строку
    2. What is PIP?
    3. How to update Python on Windows Operating System?
    4. How To Upgrade Python on macOS?
    5. How to Update Python version on LINUX?
    6. Conclusion
    7. Как обновить Python в Windows?
    8. Введение
    9. Узнаем текущую версию
    10. Скачиваем последнюю версию
    11. Установка
    12. Проверка установки
    13. Заключение
    14. Как обновить Python через консоль?
    15. Как обновить Пип в Питоне?
    16. Как обновить пакеты Python?
    17. Как изменить версию Python Windows?
    18. Как обновить PIP python3?
    19. Как обновить Python до последней версии Windows?
    20. Как обновить PIP в Pycharm?
    21. Как установить pip install?
    22. Как обновить Python Mac?
    23. Как удалить модуль в Python?
    24. Как проверить установлен ли Python на Windows?
    25. Как изменить версию питона в Pycharm?
    26. Как установить Python на Windows?
    27. Как проверить есть ли PIP?
    28. Что такое pip install?
    29. Как обновить PIP в Windows
    30. Содержание статьи
    31. План обновления PIP в Windows
    32. Проверка текущей версии PIP
    33. Инструмент для обновления PIP в Windows
    34. Как вернуться к предыдущей версии PIP

    Как обновить pip через командную строку

    Когда мы узнаём, что необходимо обновить pip (менеджер пакетов в Python)? Как правило, во время загрузки каких-либо модулей.

    ustanovka PyQt5 2 После инсталляции PyQt5 появилось сообщение о необходимости обновления версии pip 20.1.1 до версии 20.2.2. Обратите внимание, что указана и команда при помощи который можно сделать обновление

    Итак, наша задача обновить версию pip на компьютере, работающем под управлением Windows. Первоначально запускаем cmd.exe — интерпретатор командной строки. После запуска, вводим команду обновления pip для Питона python — m pip install — upgrade pip и жмём Enter.

    obnovlenie pip Python Обновление pip прошло успешно

    Если при обновлении pip возникает ошибка, попробуйте сначала перейти в каталог с файлом python.exe. Для этого нужно знать местонахождение этого файла. В нашем случае абсолютный путь к каталогу с файлом c:UsersAdminAppDataLocalProgramsPythonPython38-32

    Шаг 1. Переходим в корневой каталог системного диска при помощи команды cd

    obnovlenie pip Python 1 При помощи команды cd мы перешли в корень диска «С»

    Шаг 2. Теперь перейдём в каталог, в котором находится Питон. Снова будем использовать команду cd с указанием абсолютного пути:

    obnovlenie pip Python 2 Теперь мы находимся в папке с файлом python.exe. Python38-32 означает, что это версия Python 3.8 32-х разрядная

    Шаг 3. Запускаем уже известную нам команду обновления pip python — m pip install — upgrade pip

    obnovlenie pip Python 3 Поскольку мы ранее уже обновили pip, появилось сообщение «Requirements already up-to date», которое означает, что уже установлена актуальная версия pip

    Если на вашем компьютере установлено несколько версий Python, то для каждой нужно отдельно обновлять pip, указывая абсолютный путь. В качестве примера мы обновим pip для 64-битной версии Python 3.7 также установленном на нашем ПК.

    obnovlenie pip Python 4 Обновление pip для Python 3.7 прошло успешно

    Источник

    Are you looking to update Python version to the latest python version? Then this blog post will guide you with how to upgrade Python version.

    cover509

    List of content you will read in this article:

    Python is an open-source high-level programming language that allows users to execute commands and plugins on their machine and even software from several major suppliers. It means that you can operate it on many different operating systems, including the Windows VPS Server. Python is a cross-platform programing language.

    Pip is one of the best applications for Python packages installation and administration. Pip’s popularity stems from the large number of apps that use this tool. Pip enables 3rd Party package installed to manage binary packages with the quickly configured package manager. Since Python’s latest releases have piping as normal, this guide will explain how to install PIP, how to update Python version with a complete step-by-step guide.

    What is PIP?

    PIP is a software management framework for installing and managing Python-written program packages. It is called the ‘preferred software installer’ or ‘Pip Installs Packages.’ PIP used for Python, is a command-line interface for handling PyPI program installation. You might need to upgrade PIP if you’re using an earlier version of Python on Windows. Download the application file, open the command- line and start the installer to run PIP on Windows quickly. It will teach you how PIP is installed on Windows, how it can be modified, upgraded, and set up.

    How to update Python on Windows Operating System?

    Go to the Python update page and download and install the Python 3.9 installer to update the python on your windows system. You’re still undecided about which version to have. It is recommended to use the Windows x86–64 executable installer.

    60bf73e7ec6b4 python windows installer

    Python Installer (Recommended) (Screenshot from the Python Download page)

    Check the «Add Python to Path» option during installation to register Python3.9 as your system’s main Python.

    How To Upgrade Python on macOS?

    You can download the latest version of Python for macOS from the official Python website, similar as you did on windows OS to update Python version on your system. To check it is updated to the lasted version or not follow the below-listed commands to check Python version.

    Open the terminal window and type the following commands:

    Then, at the bottom, add this segment.

    Python 3.9 version can be checked using the following command.

    How to Update Python version on LINUX?

    Users can use the below listed Linux commands to upgrade Python version to the latest released version:

    ppa:deadsnakes/ppa can be added to the system’s Software Sources to upgrade the machine with unsupported packages from this untrusted PPA.

    $ sudo add-apt-repository ppa:deadsnakes/ppa

    This command is used to update Python package.

    $ sudo apt install python3.9

    Then, using the commands below, you can search the versions of your new and current Python installations:

    This command will show you the following version of python installed in your system

    Conclusion

    We have seen how to update Python version on operating systems like Windows, Mac OS, and Linux. Follow the guide carefully to update your python software. we believe this guide fulfills your requirement though you can install the latest version successfully. Leave your comments below for your feedback and queries.

    Источник

    Как обновить Python в Windows?

    Подробно рассмотрим как правильно обновить язык программирования Python.

    Введение

    Технологии развиваются быстро, а языки программирования — это основной драйвер развития. Нередко выходят корректирующие релизы исправляющие найденные ошибки или версии с расширением функционала. Python в этом плане ничем не отличается от других языков программирования, но процесс его обновления не столь сложен, как может показаться сначала. Если у вас получится обновить один раз, вы уже не забудете как его повторить, потому что это не сложно и очень быстро.

    Узнаем текущую версию

    Скачиваем последнюю версию

    Переходим на официальный сайт www.python.org/downloads/ и скачиваем последнюю версию

    Нажимаем кнопочку Download Python и скачиваем дистрибутив

    Установка

    Так как у меня установлена уже последняя версия Python мне пришлось скачать beta версию для демонстрации процесса обновления. Не пугайтесь из за того, что на картинках другая версия, это не ошибка 🙂

    Ставим обязательно галочку перед пунктом Add Python 3.9 to PATH.

    Нажимаем Install Now и переходим далее.

    Обязательно предоставляем полные права приложению

    Дожидаемся окончания процесса установки и в конце нажимаем Close

    Проверка установки

    В самом начале я описал процесс сверки текущий версии Python. Нам сейчас это необходимо повторить, только предварительно перезапустив окно cmd.exe иначе запуститься python старой версии 🙂

    Заключение

    В этой статье мы рассмотрели процесс обновления языка программирования Python, прошли от первого до последнего шага и успешно завершили обновление.

    На это все. Поздравляю, теперь у вас установлена последняя версия Python.

    Источник

    Как обновить Python через консоль?

    Первоначально запускаем cmd.exe — интерпретатор командной строки. После запуска, вводим команду обновления pip для Питона python —m pip install —upgrade pip и жмём Enter. Если на вашем компьютере установлено несколько версий Python, то для каждой нужно отдельно обновлять pip, указывая абсолютный путь.

    Как обновить Пип в Питоне?

    Как обновить пакеты Python?

    Через командную строку windows выполните команду: pip list —outdated вы получите список устаревших пакетов. Run: pip install [package] —upgrade он обновит [package] и удалит предыдущую версию.

    Как изменить версию Python Windows?

    Как обновить PIP python3?

    Как обновить Python до последней версии Windows?

    xz (патч), просто перейдите на страницу загрузок Python, получите последнюю версию и начните установку. Поскольку на вашем компьютере уже установлен Python, установщик предложит вам «Обновить сейчас». Нажмите на эту кнопку, и она заменит существующую версию новой.

    Как обновить PIP в Pycharm?

    Чтобы обновить pip на pycharm:

    Как установить pip install?

    Как установить PIP на Windows.

    Как обновить Python Mac?

    Проще всего скачать установщик Python с сайта python.org.

    Как удалить модуль в Python?

    Зайдите в каталог «site-packages» вашей установки python и удалите файлы вручную. И он был удален.

    Как проверить установлен ли Python на Windows?

    Если у вас установлен Python, самый простой способ проверить номер версии — ввести «python» в командной строке. Он покажет вам номер версии, и если он работает на 32-битной или 64-битной и другой информации. Для некоторых приложений вы хотели бы иметь последнюю версию, а иногда и нет.

    Как изменить версию питона в Pycharm?

    Как установить Python на Windows?

    Лучший способ установить Python на Windows — это скачать официальный установщик с сайта python.org. Чтобы сделать это, откройте браузер и перейдите по ссылке https://python.org/. После завершения загрузки установщика, откройте «Загрузки».

    Как проверить есть ли PIP?

    Что такое pip install?

    pip — система управления пакетами, которая используется для установки и управления программными пакетами, написанными на Python. Много пакетов можно найти в Python Package Index (PyPI). Начиная с версии Python 2.7.9 и Python 3.4, они содержат пакет pip (или pip3 для Python 3) по умолчанию.

    Источник

    Как обновить PIP в Windows

    DevOps Worm 2022

    pip

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

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

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

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

    01 upgrade pip 20.1.1

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

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

    Telegram Чат & Канал

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

    Паблик VK

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

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

    План обновления PIP в Windows

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

    001 cm upgrade pip

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

    001 upgrade pip 20.0.2

    011 upgrade pip 02

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

    012 upgrade pip 02

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

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

    002 upgrade pip 19 0 3 768x494 1

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

    003 upgrade pip 19 0 3

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

    004 upgrade pip 19 0 3

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

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

    005 upgrade pip 19 0 3

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

    03 upgrade pip 20.1.1

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

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

    011 upgrade pip 02 1

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

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

    007 upgrade pip 19 0 3 768x353 1

    008 upgrade pip 19 0 3

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

    009 upgrade pip 19 0 3

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

    005 upgrade pip 20.1.1

    Инструмент для обновления PIP в Windows

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

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

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

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

    001 upgrade pip tool 1

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

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

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

    011 upgrade pip 19 0 3

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

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

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

    05 upgrade pip 19.1

    site admin

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

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

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

    Источник

    1. Используйте pip для обновления пакета Python
    2. Используйте блокнот Jupyter для обновления пакета Python
    3. Используйте виртуальную среду для обновления пакетов Python
    4. Используйте среду pipenv для обновления пакетов Python

    Обновить пакет Python

    Каждое программное обеспечение, созданное в этом мире, время от времени требует регулярной проверки, чтобы исправить ошибки и максимально использовать это программное обеспечение. Как и любое другое программное обеспечение, программное обеспечение Python также необходимо время от времени исправлять и обновлять. В Python есть множество встроенных пакетов и модулей, которые время от времени нужно обновлять. Это потому, что в них постоянно добавляется множество функций и встроенных функций. Другая причина в том, что устаревшие пакеты могут не поддерживать последнюю версию Python.

    В этом руководстве будут продемонстрированы некоторые методы обновления пакета в Python.

    Используйте pip для обновления пакета Python

    Чтобы обновить пакеты Python через командную строку компьютера, выполните следующие команды.

    pip install --upgrade [package name]==[package version or latest package version]
    

    В некоторых случаях пользователю может потребоваться использовать pip3 вместо pip.

    Еще один способ обновить пакет Python в Linux — выполнить следующую команду.

    sudo pip install [package_name] --upgrade
    

    Опять же, pip или pip3 могут отличаться от одной операционной системы к другой.

    Использование sudo — более безопасный способ работы в командной строке, поскольку он запрашивает системный пароль перед выполнением действия.

    Используйте блокнот Jupyter для обновления пакета Python

    Блокнот Jupyter — это бесплатное веб-приложение с открытым исходным кодом, которое позволяет пользователю писать код на Python и выполнять такие задачи, как визуализация данных, машинное обучение и т. Д. Оно имеет графический интерфейс пользователя (GUI), называемый Anaconda Navigator, который помогает запускать такие веб-приложения и одновременно управлять своими пакетами и модулями.

    Блокнот Jupyter также можно использовать для обновления пакетов Python. Ниже приводится команда для выполнения этой задачи:

    !pip install <package_name> --upgrade
    

    Используйте виртуальную среду для обновления пакетов Python

    Этот метод используется для обновления тех пакетов, которым не требуется конкретная версия Python в виртуальной среде. Код Python, используемый в этом методе, использует команду pip.

    В этом методе используется модуль pkg_resources. Этот модуль помогает находить пакеты и версии Python и управлять ими.

    В этом методе используется другой модуль, называемый subprocess, который помогает пользователю получать и запускать новые программы, получая новые процессы. Этот модуль обычно используется для замены старых версий модулей.

    import pkg_resources
    from subprocess import call
    
    for p in pkg_resources.working_set:
        call("python -m pip install --upgrade " + p.<projectname>, shell=True)
    

    Используйте среду pipenv для обновления пакетов Python

    Это один из самых простых способов обновления пакетов, для которых не требуется конкретная версия Python в конкретной виртуальной среде.

    Инструмент pipenv помогает пользователю создать виртуальную среду из собственного проекта Python, предоставляя все необходимые средства.

    Ниже приведены шаги по обновлению пакетов Python с помощью pipenv:

    Активируйте оболочку, в которую входят все пакеты, которые нужно обновить.

    Теперь обновите все пакеты:

    Понравилась статья? Поделить с друзьями:
  • Обновление powershell windows server 2012 r2
  • Обновление postgresql 12 до 13 windows
  • Обновление nokia lumia 930 до windows 10 mobile
  • Обновление nokia lumia 625 до windows 10
  • Обновление net framework для windows 7 x32