Skip to main content

Python in Linux (RHEL)

Ten years ago, the developers of the Python programming language decided to clean things up and release a backward-incompatible version, Python 3. They initially underestimated the impact of the changes, and the popularity of the language. Still, in the last decade, the vast majority of community projects has migrated to the new version, and major projects are now dropping support for Python 2.
In Red Hat Enterprise Linux 8, Python 3.6 is the default. But Python 2 remains available in RHEL 8.

Using Python in RHEL 8

To install Python, type yum install python3.
To run Python, type python3.
If that doesn’t work for you, or you need more details, read on!

Python 3

In RHEL 8, Python 3.6 is the default, fully supported version of Python. It is not always installed, however. Similarly to any other available tool, use yum install python3 to get it.
Add-on package names generally have the python3 prefix. Use yum install python3-requests to install the popular library for making HTTP connections.

Python 2

Not all existing software is ready to run on Python 3. And that’s OK! RHEL 8 still contains the Python 2 stack, which can be installed in parallel with Python 3. Get it using yum install python2, and run with python2.

Why not just “Python”?

Okay, okay, so there’s python3 and python2. But what if I use just python? Well…
$ python
-bash: python: command not found
There is no python command by default.
Why? Frankly, we couldn’t agree what python should do. There are two groups of developers. One expects python to mean Python 2, and the other Python 3. The two don’t always talk to each other, so you might be a member of one camp and not know anyone from the other – but they do exist.
Today, in 2018, the python == python2 side is more popular, even among those that prefer Python 3 (which they spell out as python3). This side is also backed by an official upstream recommendation, PEP 394. However, we expect that this viewpoint will become much less popular over the lifespan of RHEL 8. By making python always mean Python 2, Red Hat would be painting itself into a corner.

Unversioned Python command

alternatives --set python /usr/bin/python3
For Python 2, use /usr/bin/python2 instead. For details on how to revert the changes or do the setup interactively, see man unversioned-python.
Moving on for the live demo:

How to Install Python 3 / Python 2.7 on RHEL 8
The procedure for installing Python 3 on RHEL 8 is as follows:
  1. Open the Terminal application or window.
  2. Search for python package in RHEL 8, run: sudo yum search python3
  3. To install python 3 on RHEL 8, run: sudo yum install python3
  4. To install python 2 on RHEL 8, run: sudo yum install python2
  5. Upgrade python 3 in RHEL 8, run: sudo yum upgrade python3
  6. Upgrade python 2 in RHEL 8, run: sudo yum upgrade python2
Let us see all commands and example in details.

How to find out Python package names on RHEL 8

Try any one of the following syntax along with grep command:
sudo yum search python3 | more
sudo yum search python2 | more
sudo yum search python36
sudo yum search python2 | grep 'python2.x86_64'

You can show detailed information before installing package as well:
sudo yum info python2.x86_6
sudo yum info python36

RHEL 8 install Python 3

Type the following yum command to install Python 3 on Red Hat Enterprise Linux version 8:
sudo yum install python3
OR
sudo yum module install python36

Verify installation by typing the type command/command command:
$ type -a python3
python3 is /usr/bin/python3
$ command -V python3
python3 is hashed (/usr/bin/python3)
$ python3 --version
Python 3.6.6

RHEL 8 install Python 2

Let us see how to install Python 2.7 on RHEL 8:
sudo yum install python27
OR
sudo yum module install python27
Let us find out information about installed version of Python 2.7 in RHEL 8:
$ type -a python2
$ command -V python2
$ python2 --version

Comments

Popular posts from this blog

SQL Dorks

-------------------------------------------------------------------------------- Admin 22-05-2014, 08:20 PM cat.asp?-cat= productlist.asp?catalogid= Category.asp?category_id= Category.cfm?category_id= category.asp?cid= category.cfm?cid= category.asp?cat= category.cfm?cat= category.asp?id= index.cfm?pageid= category.asp?catid= Category.asp?c= Category.cfm?c= productlist.cfm?catalogid= productlist.asp?catalogid= viewitem.asp?catalogid= viewitem.cfm?catalogid= catalog.cfm?catalogId= catalog.asp?catalogId= department.cfm?dept= department.asp?dept= itemdetails.cfm?catalogId= itemdetails.asp?catalogId= product_detail.asp?catalogid= product_detail.cfm?catalogid= product_list.asp?catalogid= product_list.cfm?catalogid= ShowProduct.cfm?CatID= ShowProduct.asp?CatID= search_results.cfm?txtsearchParamCat= search_results.asp?txtsearchParamCat= itemdetails.cfm?catalogId= itemdetails.asp?catalogId= store-page.cfm?go= store-page.asp?go= Detail.cfm?CatalogID= Detail.asp?CatalogID= browse.cfm?category_i...

10 BEST LINUX DISTRIBUTION FOR HACKING &PEN TESTING 2020

🔴Use wisely🔴 ⭕️Info:     These Linux distributions offer lots of useful tools for penetration testing, wireless security, forensic, etc.  ✍1. BackTrack 5r3 ✅useful : wireless cracking, exploiting, web application assessment, learning. ✍2. BackBox Linux  ✅Useful: penetration tests and security assessments. It provides all suspects for Forensic Analysis, Documentation & Reporting, Reverse Engineering with John, Nmap, Social Engineering Tool, etc. ✍3. Blackbuntu ✅Useful:   Tools for Information Gathering, Network Mapping, Vulnerability Identification, Penetration, Maintaining Access, radio Network Analysis, Reverse Engineering, etc.  ✍4.Samurai Web Testing Framework ✅Useful: It offers lots of open source and free tools that would help you focus on testing and attacking websites. ✍5. Knoppix STD ✅useful:  live CD and can be installed on a hard disk. The STD stands for Security Tools Distribution. Knoppix provides you a full scenario for cry...

🔰How To Remove Shortcut Virus From Your Pc🔰

✅ Method 1.  - Clean up and remove Shortcut Virus by CMD - 1. Click on  Start  and select  Run; 2. Type: CMD  and Hit Enter to open  Command Prompt; 3. Type the  drive letter  of your hard drive partition in PC or USB flash drive and hit Enter; (G for example.) 4. Type:  attrib g:*.* /d /s -h -r -s  and hit Enter. You’ll be able to see your files and data on Windows PC or USB flash drive now. ✅Method 2.  -Cleanup Shortcut Virus with Shortcut Virus Remover or Anti-virus Software- *If you need a double guarantee, you can download and install anti-virus software to clean up all shortcut virus from Windows 10/8/7 computer and USB etc external storage devices. Here below you’ll see a list of anti-virus software and tools and you can selectively choose one to try* ➡️Trojan Removal Tool; ➡️Shortcut virus fixfolder; ➡️Malwarebytes Anti-Malware, etc. ✅Method 3.  - Delete/Wipe Shortcut Virus from Registry - 1. Press Win+R and type: reged...