How to Update Python in Virtualenv

Introduction to Python & virtualenv: How They Work

Today at ARZ Host, we discuss how we Update Python in Virtualenv in Windows and Linux. We’ll look at how to update Python in the Windows system in this article. For protest purposes, we shall update Python from version 3.6.8 to version 3.9.6. Use the following command in the command prompt to see what version of Python is currently installed on your computer:

  • -V python

This will display the Python version you are currently using, as demonstrated below:

python version update

Using the installer’s executable:

To update your Python version, take the following actions:

Build Without Limits—Get 90% Off Hosting That Grows With You!

Lightning-Fast Hosting at a Fraction of the Price—Save 90% Today!

Step by Step Guide of Update Python in virtualenv

Step 1: Visit the Python website.

Visit the Python website

Phase 2: Select the Downloads tab.

Select the Downloads tab

Step 3: Depending on your system requirements, download the version you need to update to (ie, 32-bit or 64-bit). Here, we will get the 3.9.6 installer for 64-bit systems.

Explore the Best Frameworks of Python Framework for Success in your Business and Work.

Depending on your system requirements

Step 4: Click the installer to start the installation process. Make certain to choose “Add Python 3.9 to PATH.” click “Install Now” after that.

Click the installer to start the installation process

The installation will begin as indicated below:

installation will begin as indicated

Following a successful installation, you will see the following message:

Following a successful installation

Start Reselling Like a Pro—Get Exclusive Off on Reseller Hosting Today!

Be Your Own Boss—Unlock Great Offers on Reseller Hosting and Grow Fast!

Now, if you open cmd and enter the following command:

  • -V python

You can see that Python has been updated to version 3.9.6 as indicated below:

updated version

Python Package Updates for Windows and Linux

On Linux or Windows, Pip can be used to upgrade all packages:

1: Create a requirements file (requirements.txt) and output a list of installed packages in it:

  • pip freeze > specifications.txt

2: In requirements.txt, change every '==' to a '>='. Use the editor’s ‘Replace All’ command.

3: Upgrade all out-of-date software:

  • txt, pip install -r —upgrade

Related Article: Creating a Virtual Environment Python3 in our Windows and Linux system

All Packages in A Virtual Environment Are Update

all packages in a virtual environement are update
all packages in a virtual environement are update

Running the Update Python in Virtualenv script below, which uses pip, is the simplest way to update unpinned packages (i.e., packages that do not need a specific version) in a virtual environment:

import pkg_resources

from sub-process import call

for dist in pkg_resources. working set:

call ("python -m pip install --upgrade " + dist.<project name>, shell=True)

For more articles like this and more, Visit our Blog at ARZ Host.

Read More:

Table of Content