Installation
python-Installation
System Requirements Minimum Requirements
| Requirement | Details |
|---|---|
| Operating System | Linux (Ubuntu 18.04+, RHEL 8+, Debian 10+), Windows 10+, macOS 10.9+ |
| Memory | 512MB RAM minimum, 2GB recommended |
| Disk Space | 100MB for base installation, 1GB+ for development environment |
| Architecture | x86_64, ARM64, ARMv7 |
Installation Methods
- Package Manager Installation
Ubuntu/Debian:
# Add deadsnakes PPA for latest Python versions
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.11 python3.11-venv python3.11-dev
RHEL/CentOS/Fedora:
bash
# Using dnf (Fedora/RHEL 8+)
sudo dnf install python3.11 python3.11-pip python3.11-devel
# Using yum (RHEL 7/CentOS 7)
sudo yum install python3.11 python3.11-pip python3.11-devel
macOS (Homebrew):
bash
brew install python@3.11
- Source Compilation
bash
# Download and compile from source
wget https://www.python.org/ftp/python/3.11.11/Python-3.11.11.tgz
tar xzf Python-3.11.11.tgz
cd Python-3.11.11
./configure --enable-optimizations --with-lto
make -j$(nproc)
sudo make altinstall
- Container-based Installation
dockerfile
# Production-ready Dockerfile
FROM python:3.11.11-slim-bullseye
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd --create-home --shell /bin/bash app
USER app
WORKDIR /home/app
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
- Version Management with pyenv
bash
# Install pyenv
curl https://pyenv.run | bash
# Install Python 3.11.11
pyenv install 3.11.11
pyenv global 3.11.11
Post-Installation Verification
bash
# Verify installation
python3.11 --version
python3.11 -m pip --version
python3.11 -c "import sys; print(sys.version_info)"