From b5ce195c6333c041bb10d8d7011fb687638a1ca0 Mon Sep 17 00:00:00 2001 From: sundyli <543950155@qq.com> Date: Mon, 13 May 2024 17:27:20 +0800 Subject: [PATCH] feat(query): build image limit python 3.12.2 (#15501) --- scripts/setup/dev_setup.sh | 48 ++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 28 deletions(-) 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 {