To set up Python 3.8 on Ubuntu version 23.10, follow these steps in your terminal:
- First, update your package list and install necessary build dependencies:
sudo apt-get update
sudo apt-get install -y build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm \
libncurses5-dev libncursesw5-dev xz-utils tk-dev \
libffi-dev liblzma-dev python3-openssl git
- Next, download and extract the Python 3.8 source code:
mkdir ~/python38
cd ~/python38
wget https://www.python.org/ftp/python/3.8.16/Python-3.8.16.tgz
tar -xf Python-3.8.16.tgz
cd Python-3.8.16
- Configure the build:
./configure --enable-optimizations
- Compile the source code:
make -j$(nproc)
- Install Python:
sudo make install
- Verify the installation:
python3.8 --version
To create a virtual environment using Python 3.8, specify the Python version:
python3.8 -m venv <your_virtual_env_name>
Replace <your_virtual_env_name>
with the name you want to give to your virtual environment.