Download install_python.sh from NHQTools/whisper-models: direct link, hf CLI and curl.
- Browser
- Download file 1.18 kB
-
https://huggingface.co/NHQTools/whisper-models/resolve/main/install_python.sh
- Command line
-
hf download hf://NHQTools/whisper-models/install_python.sh
-
curl -L -o install_python.sh https://huggingface.co/NHQTools/whisper-models/resolve/main/install_python.sh
1.18 kB
| # Script to automatically install Python 3.11 on macOS using Homebrew | |
| # Exit on any error | |
| set -e | |
| # Check if Homebrew is installed | |
| if ! command -v brew &> /dev/null; then | |
| echo "Homebrew not found. Installing Homebrew..." | |
| /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
| # Add Homebrew to PATH for the current session | |
| eval "$(/opt/homebrew/bin/brew shellenv)" | |
| else | |
| echo "Homebrew already installed." | |
| fi | |
| # Update Homebrew | |
| echo "Updating Homebrew..." | |
| brew update | |
| # Install Python 3.11 | |
| echo "Installing Python 3.11..." | |
| brew install python@3.11 | |
| # Verify installation | |
| echo "Verifying Python 3.11 installation..." | |
| python3.11 --version | |
| # Add Python 3.11 to PATH if not already present | |
| PYTHON_PATH="/opt/homebrew/opt/python@3.11/bin" | |
| if [[ ":$PATH:" != *":$PYTHON_PATH:"* ]]; then | |
| echo "Adding Python 3.11 to PATH..." | |
| echo "export PATH=\"$PYTHON_PATH:\$PATH\"" >> ~/.zshrc | |
| source ~/.zshrc | |
| fi | |
| ln -sf /opt/homebrew/opt/python@3.11/bin/python3.11 /usr/local/bin/python | |
| ln -sf /opt/homebrew/opt/python@3.11/bin/pip3.11 /usr/local/bin/pip | |
| echo "Python 3.11 has been successfully installed!" |