Installing Python 3.8 in a venv environment on CentOS 7

CK CK 3788 
Created at  
461 0 0

Installing Python 3.8 in a venv environment on CentOS 7 requires several steps. Follow the guide below:


1. Update System Packages

First, ensure your system is up-to-date:

sudo yum update -y

2. Install Development Tools and Dependencies

Install the required tools and libraries for building Python from source:

sudo yum groupinstall -y "Development Tools"
sudo yum install -y gcc libffi-devel bzip2 bzip2-devel wget make zlib-devel \
    xz-devel sqlite-devel readline-devel tk-devel openssl-devel git

3. Download Python 3.8 Source Code

Download the Python 3.8 source code from the official Python website:

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

4. Build and Install Python 3.8

Compile and install Python:

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

Note: Use make altinstall instead of make install to prevent overwriting the default Python binary (python or python2).

Once done, verify the installation:

python3.8 --version

5. Create a Virtual Environment

Create a new virtual environment using Python 3.8:

python3.8 -m venv myenv

Activate the environment:

source myenv/bin/activate

6. Install Required Packages

After activating the environment, you can install any Python packages you need:

pip install --upgrade pip
pip install <your-packages>

Troubleshooting:

  • Missing pip in Python 3.8: If pip is missing, install it manually:

    python3.8 -m ensurepip
    python3.8 -m pip install --upgrade pip
    
  • Permissions Issue: If you encounter permission issues during installation, prepend sudo to commands where necessary.

Let me know if you face any specific problems!

Tags CentOS 7 Python 3.8 venv Facebook X
Comments 0
Similar posts
  1. Building Initial Virtual Environment at Python - The first step you should do for Python Programming
    559
  2. Upgrading PHP 7.4 to PHP 8.1 in CentOS 7
    642
  3. Beyond venv: Java's Project Isolation Strategy
    475
  4. Set up an SMTP server on CentOS 7
    726
  1. Managing WHITE_LIST in FastAPI to Improve the Server Security
    346
  2. A common async example
    966
  3. Milvus and LLM Integration - Very Smart Approach!
    294
  4. Automated API Documentation with PyCharm
    889
  5. How to install python 3.9 alongside python 3.8 on CentOS 7?
    707
  6. How to run Python 3.9 on Mac?
    647
  7. Python Quizs
    501
  8. Automated OpenAPI documentation for a Python Flask API
    1,118
  9. Automated API documentation for a Django REST Framework (DRF) project using drf-yasg (Yet Another Swagger Generator)
    1,026
  10. Uploading a file to a Google Drive Folder programmatically with Python
    3,305
  11. Garbage Collection when your system does not have enough memory in your Python App
    1,009
  12. Method to maximize full CPU performance with Python
    314
  13. How do I get the maximum available of thread in python?
    981
  14. Using Queue Algorithm with Redis - RPUSH and LPOP
    767
  15. Use cache concept with Redis : Let's do Redis programming with Python
    528
  16. CUDA versus OpenCL
    577
  17. Simple gRPC server based on Python
    393
  18. Python code to convert PDF file to Excel Spreadsheet
    695
  19. Python script to list files on your Google Drive and download one of them
    939
  20. Coinbase Python API - Basic Example
    461
  21. AWS Lambda Code Example based on Python
    333
  22. Python code using GPU on CentOS with AWS
    1,248
  23. Video Scence Detection with PySceneDetect
    2,318
  24. Python Audio Separation Libraries allowing you to isolate individual tracks
    1,433
  25. Python Version Control for Library Compatibility with pyenv - Downgrading/Upgrading Python Version
    902
  26. Deleting a specific user voice from the original audio track with Python
    547
  27. Creating an MR from the original MP3 audio in Python - Deleting Voice Track from Audio File
    436
  28. Creating mp3 audio file based on the text input with Python
    463
  29. Implementing Text To Speech / Audio with Python3 and pyttsx3
    354
  30. Building Initial Virtual Environment at Python - The first step you should do for Python Programming
    559
Recently updated
  1. Why 100% SEO Guarantees Better User Engagement and How to Achieve It in Your Service
    27
  2. Why SPF and DKIM Are Essential for Linux Email Servers?
    24
  3. How do I create animated background for Google Meet?
    19,713
  4. MaxMind GeoLite2 vs. DB-IP Lite vs. ip-api.com: Choosing the Right Free IP Geolocation Solution
    217
  5. Meet Valkey: Why Redis Changed Its License, Why Valkey is Better, and How to Use It as a Drop-in Replacement
    85
  6. How Rogue Web Scrapers Are Stealing My Content and Destroying My Server
    153
  7. Array of arguments passed to script in PHP
    85
  8. Invalid Auction Storms in Ad Tech
    93
  9. Building MRC-Compliant Instrumentation in Ad Tech: Implementation Steps and Key Challenges
    198
  10. The Two Clocks of Ad Server Architecture
    63
  11. Frequency Cap Architecture Overview
    509
  12. Collecting Proof-of-Play from 100,000 Screens
    141
  13. Vector Search in Relational Databases (RDBs): Trends & Usage Environments
    280
  14. What is RedisVL?
    105
  15. Designing a Skill Registry Architecture: Minimize Token Usage and Maximize AI Performance
    224
  16. TPU & GPU Cluster Management Tools
    232
  17. The Concept of Scaffolding in AI Agents
    221
  18. Beyond Static Pipelines: Architecting LLM Multi-Agent Systems for Autonomous Workflow Orchestration
    576
  19. AI-DLC vs. AI-SDLC: Model-Centric vs. System-Centric AI Development
    253
  20. Fine-Tuning Open-Weight LLMs: Training, Licensing, and Deploying Custom Models with Ollama
    328
  21. Inside the Next-Generation Streaming Architecture: Ultra-Low Latency, SGAI, and AI Codecs
    197
  22. Machine Learning: Training vs. Ranking
    213
  23. The Continuous Learning Machine: Designing a Loop That Actually Turns
    217
  24. The Next-Gen Low-Latency Standards: LL-HLS & MoQ
    189
  25. Designing a Data Curation System Around a Vector Database
    215
  26. Extracting Context from Live Video: The Architecture Got Simpler When We Stopped Building Features
    229
  27. The New Ad Stack Behind Live Sports Streaming: Inside SGAI, EABN, and the Standards Race to Fix Live Monetization
    649
  28. Designing MLOps Architectures to Handle Seasonal Data Drift in EV Fleet Models
    185
  29. From 15 to 40+ FPS: Accelerating PyTorch Object Detection on Automotive ECUs
    207
  30. Understanding Data Lineage
    252