AllSpice-Install/install-scripts/install-python.sh

42 lines
1.2 KiB
Bash

#!/bin/bash
echo "install python" | tee -a ~/Allspice/AllSpice-Install/log.txt
# Ensure Scoop is installed and initialized
if ! scoop help &>/dev/null; then
echo "Scoop is not installed. Installing Scoop..."
powershell -Command "Set-ExecutionPolicy RemoteSigned -Scope CurrentUser"
powershell -Command "Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')"
else
echo "Scoop is already installed."
fi
# Install or update Python to the latest 3.x version available in Scoop
echo "Installing or updating Python to the latest version in the 3.x series..."
scoop install python || scoop update python
# Verify Python installation
python --version
if [ $? -eq 0 ]; then
echo "Python installation or update was successful."
else
echo "There was an issue with the Python installation or update."
fi
# Ensure pip is installed/upgraded
echo "Ensuring pip is installed and up to date..."
python -m ensurepip
python -m pip install --upgrade pip
# Verify pip installation
pip --version
if [ $? -eq 0 ]; then
echo "pip is installed and up to date."
else
echo "There was an issue with the pip installation or update."
fi