RHEL 7 - Setting up Python2 and Python3 Environments Best Practices

Latest response


With RHEL 7 , we have Python 2.7 by default but now with Python 2 project gone obsolete , we have to move the setups one by one to Python 3. Now for such transition , we as of now need to have both the environment go hand-in-hand on server Python 2 as well as Python 3 .

Can someone please provide me with best practices to go about it .

Also, industry-wide best practices on how to install pip, how use it (sudo/root/user?) to install other python packages and how to differentiate from python3 and pip3 packages?


Abhishek Thakur



Use Python 3 from Software Collections.

The system Python 2 remains untouched, and there are several methods for having your app select Python 3.

A detailed walkthrough and explanation is provided on the RH Developer Blog:


I have a requirement to install the latest version of python, on rhel7 server, i see python3 listed in repositories. can i install python3 packages without removing the existing python packages? if so, will it not break the system? and can somebody please advise if they can both coexist on the server, is there anything we need to do to point to the new version of the python?

When using versions supplied as Software Collections, you are safe to have both co-installed as they will install alongside each other. You may need to set your apps to point to Python 3. See this article to permanently enable your python 3 app.