🌐
Red Hat
developers.redhat.com › blog › install-python3-rhel
How to install multiple versions of Python on Red Hat Enterprise Linux | Red Hat Developer
February 27, 2024 - To avoid any surprises, use an explicit version number for running Python. Here are two examples, using Python 3.6 and Python 3.9. Choose only one of them if you're following along on your machine: $ python3.6 -m venv myproject1 # for Python 3.6 $ python3.9 -m venv myproject1 # for Python 3.9
🌐
Atlantic.Net
atlantic.net › home › blog › how to: installing python 3 and creating a virtual environment (venv) in centos 7
How to: Installing Python 3 and Creating a Virtual Environment (venv) in CentOS 7
June 4, 2024 - This article covers the installation of Python 3.9 on a CentOS 7 operating system and how to create a Virtual Environment(venv) with pyvenv for which Python 3 can run. It is essential to note the directories that we are installing is Python 3.9. CentOS 7.x is dependent on Python 2.x to function correctly, do not overwrite the Python 2 installation accidentally. If you still need to install Python 2, follow our how-to on this here. You’ll need to yum install the following packets to meet all the Python 3 and PIP dependencies:
Discussions

How to install Python 3, pip, venv, Virtualenv, and Pipenv on RHEL

This article shows how to install Python 3, pip, venv, virtualenv, and pipenv on Red Hat Enterprise Linux 7. After following the steps in this article, you should be in a good position to follow many Python guides and tutorials using RHEL.

Using Python virtual environments is a best practice to isolate project-specific dependencies and create reproducible environments. Other tips and FAQs for working with Python and software collections on RHEL 7 are also covered.

There are a number of different ways to get Python 3 installed on RHEL. There are many articles and answers online that give incomplete steps or inappropriate answers for people/enterprises that are running RHEL.

This article uses Red Hat Software Collections because these give you a current Python installation that is built and supported by Red Hat. During development, support might not seem that important to you. However, support is important to those who have to deploy and operate the applications you write. To understand why this is important, consider what happens when your application is in production and a critical security vulnerability in a core library (for example SSL/TLS) is discovered. This type of scenario is why many enterprises use Red Hat.

Python 3.6 is used in this article. It was the most recent, stable release when this was written. However, you should be able to use these instructions for any of the versions of Python in Red Hat Software Collections including 2.7, 3.4, 3.5, and future collections such as 3.7.

I hope this answers a number of questions about software collections and working with Python 3 on RHEL. Feedback is welcome.

More on reddit.com
🌐 r/redhat
6
16
August 13, 2018
Install Python3.9 and new virtual environment
Seems like 3.6.8 is the latest version available for Centos 7 through the package manager. Here's a guide for upgrading Python on Centos 7 to 3.10 (and 3.11 but that's not stable yet) from the sources. https://linuxstans.com/how-to-install-python-centos/ More on reddit.com
🌐 r/learnpython
8
1
February 7, 2022
virtualenv - Unable to create virtual environment on CentOS 7.8 and python3.6 - Stack Overflow
I've had the same issue on CentOS Linux release 7.9.2009 (Core) and solved it by installing the following system packages: yum install python36-devel yum install python36-setuptools yum install python36-virtualenv python3.6 -m pip install --upgrade pip · Used virtualenv to install the venv into ... More on stackoverflow.com
🌐 stackoverflow.com
Install python3.9 in python virtual environment Debian 10 Linux
Is pyenv actually installed? Otherwise pyenv install 3.9.0 and cd into your projects dir and do pyenv local 3.9.0 for setting the python version just for this dir. Otherwise use https://github.com/pyenv/pyenv-virtualenv More on reddit.com
🌐 r/learnpython
11
0
January 16, 2021
🌐
Stack Overflow
stackoverflow.com › questions › 56221031 › how-to-install-python3-virtualenv-and-mod-wsgi-on-rhel
python 3.x - How to install python3 virtualenv and mod_wsgi on RHEL? - Stack Overflow
As a previous answer indicated, Red Hat added Python 3 (.6) to rhel7 with the release of 7.7. This can be used by installing the python3* packages with yum.
🌐
Medium
medium.com › @vivekpemawat › setting-up-python3-9-3f4373dccb92
Setting Up Python 3.9 on centos7: A Quick Guide - Vivek Pemawat - Medium
December 8, 2023 - sudo yum install wget wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz tar xzf Python-3.9.6.tgz cd Python-3.9.6 sudo ./configure --enable-optimizations sudo make altinstall · Note: Using make altinstall prevents Python 3.9 from ...
🌐
Reintech
reintech.io › blog › installing-python-3-centos-9
Installing Python 3 on CentOS 9 | Reintech media
March 8, 2026 - # Install the venv module (usually included, but ensure it's present) sudo dnf install python3-virtualenv -y # Create a new project directory and virtual environment mkdir ~/my_project cd ~/my_project python3 -m venv venv # Activate the virtual ...
🌐
Liquid Web
liquidweb.com › home › how to set up a python virtual environment on centos
How to Set Up A Python Virtual Environment On CentOS | Liquid Web
April 7, 2025 - These instructions assume you already have a working installation of Python 2 and Python 3 versions 3.3 or higher, with pip, on your server. If you’re looking for instructions on how to get Python 3 installed on your CentOS 7 box, check out this tutorial! As of Python version 3.3 and later, a module named Venv has been included in the Python standard library.
🌐
GitHub
gist.github.com › MichaelCurrin › 3a4d14ba1763b4d6a1884f56a01412b7
Set up Python 3 and new virtual environment - Gist - GitHub
How to install Python in macOS, Linux or Windows. Create virtual env. ... Activate virtual env. $ # Linux/macOS $ source venv/bin/activate $ # Windows $ venv\Scripts\activate
Find elsewhere
🌐
TecAdmin
tecadmin.net › install-python-3-9-on-centos-8
How to Install Python 3.9 on CentOS/RHEL 8 – TecAdmin
April 26, 2025 - This Python installation required the GCC compiler on your system. Login to your server using ssh or shell access. Now, use the following command to install prerequisites for Python before installing it. sudo dnf install wget yum-utils make gcc openssl-devel bzip2-devel libffi-devel zlib-devel
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-install-python-3-and-set-up-a-programming-environment-on-rocky-linux-9
How To Install Python 3 and Set Up a Programming Environment on Rocky Linux 9 | DigitalOcean
November 1, 2022 - To set this up, you can follow our Initial Server Setup Guide for Rocky Linux 9. Before we begin with the installation, let’s make sure to update the default system applications to ensure we have the latest versions available. We will be using the open-source package manager tool DNF, which stands for Dandified YUM the next-generation version of the Yellowdog Updater, Modified (that is, yum).
🌐
Reddit
reddit.com › r/learnpython › install python3.9 and new virtual environment
r/learnpython on Reddit: Install Python3.9 and new virtual environment
February 7, 2022 -

Hi, I'm running Centos 7.9 and Python 3.6.8. I have all my scripts running a virtual environment using Python 3.6.8.

I need to use some features in Python3.7 so I thought I would just go straight to 3.9. Has anybody got some clear instructions for me to a) install Python3.9 on CentOS and b) setup a new virtual environment using that new version of Python?

I have a lot of scripts running in my existing virtual environment so want to set this up in parallel so I don't affect the old environment. I can then migrate each script one at a time.

Any help appreciated.

Mark

🌐
Teststation
blog.teststation.org › centos › python › 2016 › 05 › 11 › installing-python-virtualenv-centos-7
Installing Python 3 with virtualenv on CentOS 7 · Teststation
yum install epel-release · Install python34 and python-pip packages with: yum install python34 python-pip · Update pip and install virtualenv with: pip install -U pip pip install -U virtualenv · Create and activate a new python3 virtualenv with: virtualenv -p python3 <env_name> Activate ...
🌐
GitHub
gist.github.com › barseghyanartur › 479b0b4749d7a726167faf834706c852
Install virtualenv on Python 3.9 · GitHub
Install virtualenv on Python 3.9 ... the specific venv: sudo apt install python3.9 sudo apt install python3.9-dev sudo apt install python3.9-venv ·...
🌐
Reddit
reddit.com › r/learnpython › install python3.9 in python virtual environment debian 10 linux
r/learnpython on Reddit: Install python3.9 in python virtual environment Debian 10 Linux
January 16, 2021 -

Hi All,

I am looking to install python3.9 in a virtual environment in my Debian 10 machine. How could I do that? I tried to give command python3.9 -m venv ~/py_env/web_app when creating a virtual environment. but it said bad command. When I python3 -m venv ~/py_env/web_app it creates a virtual environment. with the current version of python3 (python 3.7) which is installed in the system. Would anyone be able to help me in this regards.

Thanks & Best Regards

Michael

Top answer
1 of 13
86

The recommended way by python.org

The recommended way of managing virtual environments since Python 3.5 is with the venv module within the Python Standard Library itself.

Source: https://docs.python.org/3/library/venv.html#creating-virtual-environments

That is not the same as virtualenv, which is a third party package, outside the Python Standard Library.

Source: https://pypi.org/project/virtualenv/

Dangerous to downgrade (and to upgrade)

Depending on if your system itself uses Python, it could be dangerous for system stability to change the system Python version. Your system might need exactly that version of Python. That is true with Ubuntu.


Instructions for Ubuntu

Tested on Ubuntu 20.04

Install another version of Python

Safer than downgrading or upgrading is installing other versions of Python on the same system.

For example, to install Python 3.9:

## Add the deadsnakes repository
me@mydevice:~$ sudo add-apt-repository ppa:deadsnakes/ppa

## Update package lists
me@mydevice:~$ sudo apt update

## Install Python 3.9
me@mydevice:~$ sudo apt install python3.9

Install the venv package and create a venv virtual environment

## Install the venv package for Python 3.9
me@mydevice:~$ sudo apt install python3.9-venv

## Make a folder for venv virtual environments
me@mydevice:~$ mkdir ~/.venvs

## Create a new venv virtual environment with Python 3.9 in it
me@mydevice:~$ python3.9 -m venv ~/.venvs/my-venv-name

## Activate the new venv
me@mydevice:~$ source ~/.venvs/my-venv-name/bin/activate
(my-venv-name) me@mydevice:~$

Check versions within the venv virtual environment

## Check the Python version inside the venv:
(my-venv-name) me@mydevice:~$ python -V
Python 3.9.9

## Check the Pip version inside the venv:
(my-venv-name) me@mydevice:~$ pip3 --version
pip 21.2.4 from /home/me/.venvs/my-venv-name/lib/python3.9/site-packages/pip (python 3.9)

Deactivate the venv virtual environment

(my-venv-name) me@mydevice:~$ deactivate
me@mydevice:~$

Check versions outside any virtual environments

## Check Python version:
me@mydevice:~$ python -V
Python 3.8.10

## Check the Pip version:
me@mydevice:~$ pip3 --version
pip 20.0.2 from /home/me/.venvs/my-venv-name/lib/python3.8/site-packages/pip (python 3.8)

Install more Python versions

To install more Python versions, just change the version number from 3.9 to which ever version you choose, that is available from the deadsnakes repository.

2 of 13
57

Simple and recent

Supposed that you have a different version of Python installed in your system. To check use the following command to check:

py --list

Output:

 -3.10-64 *
 -3.7-64

And you want to create a new virtual environment for python 3.7 on a 'test_env' directory. Run the following command:

py -3.7 -m venv test_env

Then activate the test_env by running the following command in Windows PowerShell:

.\test_env\Scripts\Activate.ps1

Or Linux:

source test_env/bin/activate

Check:

python --version

Output:

Python 3.7.0
🌐
PhoenixNAP
phoenixnap.com › home › kb › devops and development › how to install latest version of python 3 on centos 7
How to Install Latest Version Of Python 3 on CentOS 7
November 10, 2022 - If you are using a CentOS release older than 7.7, you need to add IUS, a yum repository that provides newer software versions and includes Python 3. ... Wait for the installation to complete. Then, update the repository: ... Note: Not sure which CentOS release you are running? There are many different ways to check the CentOS version. 3. Install Python 3 by running the following command in the terminal window: ... Wait for the installation to complete. The output should display it has installed python3 and the required dependencies.
🌐
Linux Stans
linuxstans.com › how-to-install-python-centos
How to Install Python 3.10 (or 3.11) on CentOS - Linux Stans
January 24, 2022 - 9 yum install epel-release 10 yum install python3-pip 11 pip3 install websockets 12 history