• WordPress
  • cPanel
  • Softaculous
  • KVM Virtualization
  • Vmware Virtualization
  • Proxmox
Friday, May 23, 2025
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
No Result
View All Result
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux

How to Install Python on Oracle Linux

in Linux OS, Oracle Linux
How to Install Python on Oracle Linux

Python is a popular, high-level, and versatile programming language that can be utilized for various purposes such as web development, data analysis, artificial intelligence, and more. If you’re using Oracle Linux, you might want to install Python to leverage its capabilities. In this tutorial, we’ll guide you through the process of how to install Python on Oracle Linux.

Table of Contents

  1. Prerequisites
  2. Installing Python using YUM
  3. Installing Python from Source
  4. Verify Python Installation
  5. Setting up a Virtual Environment
  6. Conclusion

Prerequisites

Before you begin, ensure that you have:

  • Oracle Linux 7 or 8 installed on your system
  • Root or sudo access to execute commands

If you need help with other Oracle Linux installations, check out these guides:

  • How to install Nginx on Oracle Linux
  • How to install Apache on Oracle Linux
  • How to install CWP on Oracle Linux

How to Install Python on Oracle Linux

Installing Python using YUM

Oracle Linux uses YUM (Yellowdog Updater, Modified) as the package manager. To install Python using YUM, follow these steps:

  1. Update your system packages:
sudo yum update
  1. Install the EPEL repository:
sudo yum install epel-release
  1. Install Python:
sudo yum install python3

This command installs the latest available version of Python 3 from the EPEL repository.

Installing Python from Source

If you want to install a specific version of Python or prefer to compile it from source, follow these steps:

  1. Update your system packages:
sudo yum update
  1. Install required dependencies:
sudo yum groupinstall "Development Tools"
sudo yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
  1. Download the desired Python version from the official website:
wget https://www.python.org/ftp/python/3.x.y/Python-3.x.y.tar.xz

Replace 3.x.y with the desired version number, for example, 3.9.7.

  1. Extract the downloaded archive:
tar xvf Python-3.x.y.tar.xz
  1. Change to the extracted directory:
cd Python-3.x.y
  1. Configure the build:
./configure --enable-optimizations
  1. Compile and install Python:
make
sudo make altinstall

Using altinstall instead of install prevents the new Python installation from conflicting with the system’s default Python.

Verify Python Installation

To verify that Python is installed correctly, run the following command:

python3 --version

This command should output the installed Python version.

Setting up a Virtual Environment

Using a virtual environment is a best practice for Python development, as it allows you to isolate project dependencies. To set up a virtual environment, follow these steps:

  1. Install the python3-venv package:
sudo yum install python3-venv
  1. Create a new directory for your project:
mkdir my_project
cd my_project
  1. Create a virtual environment within the project directory:
python3 -m venv venv

This command creates a new virtual environment named venv in the my_project directory.

  1. Activate the virtual environment:
source venv/bin/activate

After activating the virtual environment, your command prompt should change to indicate that the virtual environment is active.

  1. Install packages within the virtual environment:
pip install package_name

Replace package_name with the desired package to install, for example, numpy or django.

  1. Deactivate the virtual environment when you’re done:
deactivate

Deactivating the virtual environment returns you to the system’s default Python environment.

Conclusion

You have successfully installed Python on your Oracle Linux system and set up a virtual environment for your Python projects. Python is a powerful language with many applications, and having it installed on your Oracle Linux system will enable you to develop a wide variety of projects.

For more Oracle Linux tutorials and guides, check out the following articles:

  • How to install Plesk on Oracle Linux
  • How to install Cpanel on Rocky Linux
  • How to install Git on Rocky Linux
  • How to install PostgreSQL on Rocky Linux
  • How to set up RAID 1 on Rocky Linux
ShareTweet
Previous Post

How to Install Nginx on Oracle Linux

Next Post

How to Install TensorFlow on Oracle Linux

Related Posts

How to Install Tomcat on Rocky Linux

How to Install Apache Tomcat on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Install Bacula Backup Server on Rocky Linux

How to Install Bacula Backup Server on Rocky Linux

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Golden Host VPS
  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.

  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.