How to install python 3.9 alongside python 3.8 on CentOS 7?

CK CK 3788 
Created at  
711 0 0

To install Python 3.9 alongside Python 3.8 on CentOS 7, you can do this safely using either altinstall or environment managers like pyenv. Below is a detailed guide using the altinstall method (safe for keeping multiple versions side by side).

 

Step 1: Install Required Build Dependencies

sudo yum groupinstall "Development Tools" -y
sudo yum install gcc openssl-devel bzip2-devel libffi-devel wget make -y

 

Step 2: Download and Extract Python 3.9

cd /usr/src
sudo wget https://www.python.org/ftp/python/3.9.18/Python-3.9.18.tgz
sudo tar xzf Python-3.9.18.tgz
cd Python-3.9.18

 

Step 3: Build and Install Python 3.9

sudo ./configure --enable-optimizations
sudo make altinstall

❗ Use make altinstall (not make install) to avoid overwriting the default python binary.

 

Step 4: Verify Installation

python3.9 --version

Now you can use python3.8 and python3.9 independently.

Tags CentOS7 Python3.8 Python3.9 Facebook X
Comments 0
Similar posts
  1. How to run Python 3.9 on Mac?
    652
  2. chmod by type (directory and file permission)
    734
  3. Check network port is open or not on CentOS 7
    1,189
  4. Change MySQL port number for security purpose
    815
  5. CentOS warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory on CentOS 7
    1,073
  1. What is RedisVL?
    109
  2. What “GPU Clustering” Really Means (And How to Code for It)
    204
  3. How to Build a Python Chatbot That Writes and Runs Code Using Microsoft AutoGen (With Sample Code)
    239
  4. Beyond Prompt Engineering: Why Loop Engineering is the Future of Autonomous AI
    303
  5. A Python Code to get the Server Instance ID for Remote Management
    362
  6. From Local Python Web to Standalone
    2,046
  7. Demystifying FAISS: Your Guide to ANN(Approximate Nearest Neighbor) Search
    320
  8. TensorRT for LLMs: Speed, Scale, and Why Startups Choose It Over TensorFlow
    461
  9. Python ML Technologies used for the target Segmentation
    378
  10. Managing WHITE_LIST in FastAPI to Improve the Server Security
    349
  11. A common async example
    972
  12. Milvus and LLM Integration - Very Smart Approach!
    297
  13. Automated API Documentation with PyCharm
    892
  14. Python Quizs
    501
  15. Automated OpenAPI documentation for a Python Flask API
    1,120
  16. Automated API documentation for a Django REST Framework (DRF) project using drf-yasg (Yet Another Swagger Generator)
    1,029
  17. Uploading a file to a Google Drive Folder programmatically with Python
    3,307
  18. Garbage Collection when your system does not have enough memory in your Python App
    1,013
  19. Method to maximize full CPU performance with Python
    317
  20. How do I get the maximum available of thread in python?
    990
  21. Using Queue Algorithm with Redis - RPUSH and LPOP
    770
  22. Use cache concept with Redis : Let's do Redis programming with Python
    533
  23. Installing Python 3.8 in a venv environment on CentOS 7
    463
  24. CUDA versus OpenCL
    579
  25. Simple gRPC server based on Python
    396
  26. Python code to convert PDF file to Excel Spreadsheet
    701
  27. Python script to list files on your Google Drive and download one of them
    941
  28. Coinbase Python API - Basic Example
    462
Recently updated
  1. Why 100% SEO Guarantees Better User Engagement and How to Achieve It in Your Service
    42
  2. Why SPF and DKIM Are Essential for Linux Email Servers?
    36
  3. How do I create animated background for Google Meet?
    21,000
  4. MaxMind GeoLite2 vs. DB-IP Lite vs. ip-api.com: Choosing the Right Free IP Geolocation Solution
    251
  5. Meet Valkey: Why Redis Changed Its License, Why Valkey is Better, and How to Use It as a Drop-in Replacement
    94
  6. How Rogue Web Scrapers Are Stealing My Content and Destroying My Server
    157
  7. Array of arguments passed to script in PHP
    90
  8. Invalid Auction Storms in Ad Tech
    98
  9. Building MRC-Compliant Instrumentation in Ad Tech: Implementation Steps and Key Challenges
    202
  10. The Two Clocks of Ad Server Architecture
    70
  11. Frequency Cap Architecture Overview
    515
  12. Collecting Proof-of-Play from 100,000 Screens
    146
  13. Vector Search in Relational Databases (RDBs): Trends & Usage Environments
    288
  14. Designing a Skill Registry Architecture: Minimize Token Usage and Maximize AI Performance
    231
  15. TPU & GPU Cluster Management Tools
    245
  16. The Concept of Scaffolding in AI Agents
    234
  17. Beyond Static Pipelines: Architecting LLM Multi-Agent Systems for Autonomous Workflow Orchestration
    583
  18. AI-DLC vs. AI-SDLC: Model-Centric vs. System-Centric AI Development
    259
  19. Fine-Tuning Open-Weight LLMs: Training, Licensing, and Deploying Custom Models with Ollama
    339
  20. Inside the Next-Generation Streaming Architecture: Ultra-Low Latency, SGAI, and AI Codecs
    202
  21. Machine Learning: Training vs. Ranking
    222
  22. The Continuous Learning Machine: Designing a Loop That Actually Turns
    222
  23. The Next-Gen Low-Latency Standards: LL-HLS & MoQ
    195
  24. Designing a Data Curation System Around a Vector Database
    221
  25. Extracting Context from Live Video: The Architecture Got Simpler When We Stopped Building Features
    256
  26. The New Ad Stack Behind Live Sports Streaming: Inside SGAI, EABN, and the Standards Race to Fix Live Monetization
    656
  27. Designing MLOps Architectures to Handle Seasonal Data Drift in EV Fleet Models
    196
  28. From 15 to 40+ FPS: Accelerating PyTorch Object Detection on Automotive ECUs
    219
  29. Understanding Data Lineage
    262
  30. System Requirements and Architecture: Intelligent Priority-Based Scheduler
    167