Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Python Tips & Tricks»How to Install Python on Rocky Linux 9

    How to Install Python on Rocky Linux 9

    By RahulAugust 1, 20233 Mins Read

    Python, an open-source, versatile, and powerful language, is popular for a variety of applications, from web development to data analysis and machine learning. Whether you are a seasoned developer or a beginner, knowing how to install Python on your system is essential.

    This guide will walk you through the process of installing Python on Rocky Linux 9, a community-driven Linux distribution which aims to provide a production-ready enterprise software experience.

    Preparing the System

    Before you start the Python installation process, it’s essential to ensure that your system is up-to-date. Open the Terminal and execute the following command:

    sudo dnf update -y  
    

    Enter your password when prompted. The -y option will allow the operation to proceed without waiting for your confirmation.

    Checking for Pre-Installed Python

    Many Linux distributions come with a version of Python pre-installed. To check this, use the following command:

    python3 --version 
    

    If Python 3 is installed, the system will output the version number. If not, you’ll see an error message.

    Installing Python

    Rocky Linux 9 uses the DNF package manager, making the Python installation process straightforward.

    1. Installing Python 3
    2. To install Python 3, use the following command:

      sudo dnf install -y python3 
      

      Again, the -y option is used to allow the operation to proceed without user confirmation.

    3. Checking the Installation
    4. After the installation is complete, you can verify it by checking the version of Python. Use the following command:

      python3 --version 
      

      The system should now output the version of Python that was installed.

    Installing pip

    pip, the Python package installer, is an essential tool for working with Python. It allows you to install and manage additional packages that are not part of the Python standard library.

    1. Installing pip
    2. To install pip for Python 3, use the following command:

      sudo dnf install -y python3-pip 
      
    3. Checking the Installation
    4. Verify the successful installation of pip by checking its version:

      pip3 --version 
      

      The system should display the version of pip that was installed.

    Upgrading pip

    It’s a good practice to ensure that pip is up-to-date. To upgrade pip, use the following command:

    pip3 install --upgrade pip 
    

    Conclusion

    That’s it! You’ve successfully installed Python and pip on Rocky Linux 9. You can now proceed with the installation of additional Python packages as per your requirements, using the pip installer. Remember to keep your Python environment up-to-date to take advantage of the latest features and security patches. This is as simple as periodically running sudo dnf update -y for system-wide packages, and pip3 install --upgrade package_name for individual Python packages. Happy coding!

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to Create and Use Custom Python Module

    Performance Optimization with Pylint in Python

    Understanding Case Sensitivity in Python

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to Create and Use Custom Python Module
    • How to Install and Use Podman on Ubuntu 22.04 & 20.04
    • Setting Up Laravel with Docker and Docker-compose
    • Setting Up Development Environments with PHP and Docker
    • Using Composer with Different PHP Versions in Linux
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.