Install Python 3.14 on Ubuntu 22.04
Python is a high-level, interpreted, and general-purpose programming language known for its simple syntax and readability. It is widely used for web development, automation, data analysis, artificial intelligence, machine learning, system administration, and software development.
This guide explains how to install Python 3.14 on Ubuntu 22.04 from source without affecting the system Python version.
Method 1 - One-Line Installation (Quick Install)
Installation Location:
Python will be installed at: /usr/local/bin/python3.14
Run the following command to install Python 3.14
apt update && apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget curl llvm libbz2-dev xz-utils tk-dev liblzma-dev && cd /usr/src && wget https://www.python.org/ftp/python/3.14.0/Python-3.14.0.tgz && tar xzf Python-3.14.0.tgz && cd Python-3.14.0 && ./configure --enable-optimizations && make -j$(nproc) && make altinstall
The one-line installation installs Python only. To install pip and configure a virtual environment, follow Step 5 and later steps from Method 2
Method 2 - Step-by-Step Installation
Step 1: Update System and Install Dependencies
apt update
apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev \
libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev \
wget curl llvm libbz2-dev xz-utils tk-dev liblzma-dev
Step 2: Download Python 3.14 Source Code
cd /usr/src
wget https://www.python.org/ftp/python/3.14.0/Python-3.14.0.tgz
tar xzf Python-3.14.0.tgz
cd Python-3.14.0
Step 3: Compile and Install Python
./configure --enable-optimizations
make -j$(nproc)
make altinstall
Use
altinstallso the system Python is not overwritten.
Step 4: Verify Python Installation
python3.14 --version
Step 5: Install pip for Python 3.14
python3.14 -m ensurepip
python3.14 -m pip install --upgrade pip
Step 6: Set Python 3.14 as Default (Optional)
update-alternatives --install /usr/bin/python python /usr/local/bin/python3.14 1
update-alternatives --config python
Step 7: Create Virtual Environment
python3.14 -m venv myenv
source myenv/bin/activate
Uninstall Python 3.14 (If Needed)
rm -rf /usr/local/bin/python3.14
rm -rf /usr/local/lib/python3.14 CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS