diff --git a/scripts/setup/dev_setup.sh b/scripts/setup/dev_setup.sh index 2df005e669cd..8e8315283e2f 100755 --- a/scripts/setup/dev_setup.sh +++ b/scripts/setup/dev_setup.sh @@ -131,35 +131,27 @@ function install_ziglang { } function install_python3 { - PACKAGE_MANAGER=$1 - - echo "==> installing python3..." + echo "==> installing python3 via pyenv..." + curl https://pyenv.run | bash + + # Check if pyenv is already initialized in the profile + if ! command -v pyenv >/dev/null; then + # Add PYENV_ROOT to the profile + echo 'export PYENV_ROOT="$HOME/.pyenv"' >> $HOME/.profile + # Check if pyenv is in the PATH + echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> $HOME/.profile + # Initialize pyenv in the profile + echo 'eval "$(pyenv init -)"' >> ~/.profile + echo "pyenv environment variables have been added to ~/.profile" + else + echo "pyenv is already set in the environment variables." + fi - case "$PACKAGE_MANAGER" in - apt-get) - install_pkg python3-all-dev "$PACKAGE_MANAGER" - install_pkg python3-setuptools "$PACKAGE_MANAGER" - install_pkg python3-pip "$PACKAGE_MANAGER" - install_pkg libcairo2-dev "$PACKAGE_MANAGER" - ;; - apk) - install_pkg python3-dev "$PACKAGE_MANAGER" - install_pkg py3-pip "$PACKAGE_MANAGER" - install_pkg libffi-dev "$PACKAGE_MANAGER" - ;; - brew | pacman) - install_pkg python3 "$PACKAGE_MANAGER" - install_pkg cairo "$PACKAGE_MANAGER" - ;; - yum | dnf) - install_pkg python3-devel "$PACKAGE_MANAGER" - install_pkg cairo-devel "$PACKAGE_MANAGER" - ;; - *) - echo "Unable to install python3 with package manager: $PACKAGE_MANAGER" - exit 1 - ;; - esac + # Source the profile to apply changes to the current session + source $HOME/.profile + # install python3.12 + pyenv install 3.12.2 + pyenv global 3.12.2 } function install_openssl {