Update install_latest_python.sh
This commit is contained in:
@@ -30,7 +30,7 @@ echo "Updating package list after adding PPA..."
|
||||
sudo apt update
|
||||
check_error "Failed to update package list after adding PPA."
|
||||
|
||||
# Step 5: Install the latest Python version (e.g., Python 3.11)
|
||||
# Step 5: Install the latest Python version (e.g., Python 3.12)
|
||||
PYTHON_VERSION=3.12
|
||||
echo "Installing Python $PYTHON_VERSION..."
|
||||
sudo apt install -y python${PYTHON_VERSION}
|
||||
@@ -46,16 +46,12 @@ echo "Installing pip for Python $PYTHON_VERSION..."
|
||||
sudo apt install -y python3-pip
|
||||
check_error "Failed to install pip."
|
||||
|
||||
# If pip is not installed for the latest version, use get-pip.py
|
||||
if ! command -v pip3 &> /dev/null; then
|
||||
echo "Pip not found, downloading get-pip.py..."
|
||||
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
|
||||
sudo python${PYTHON_VERSION} get-pip.py
|
||||
check_error "Failed to install pip using get-pip.py."
|
||||
rm get-pip.py
|
||||
fi
|
||||
# Step 8: Install distutils for Python $PYTHON_VERSION (required for pip)
|
||||
echo "Installing distutils for Python $PYTHON_VERSION..."
|
||||
sudo apt install -y python${PYTHON_VERSION}-distutils
|
||||
check_error "Failed to install distutils."
|
||||
|
||||
# Step 8: Verify installation
|
||||
# Step 9: Verify installation
|
||||
echo "Verifying Python and pip installation..."
|
||||
python3 --version
|
||||
pip3 --version
|
||||
|
||||
Reference in New Issue
Block a user