Skip to content

Commit

Permalink
install_python2.sh: optimize for a quieter build process of Python 2
Browse files Browse the repository at this point in the history
  • Loading branch information
HiGarfield committed Dec 7, 2024
1 parent 573f05e commit 6c6c34f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions .github/backup/install_python2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,31 @@
sudo apt update

# Install necessary dependencies
sudo apt install -y build-essential libssl-dev libbz2-dev \
sudo apt install -y -qq build-essential libssl-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm \
libxml2-dev libxslt1-dev zlib1g-dev libffi-dev

# Download Python 2.7.x source code (adjust version number as needed)
PYTHON_VERSION=2.7.18
rm -rf "Python-$PYTHON_VERSION" "Python-$PYTHON_VERSION.tgz"
wget "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz" \
wget -q "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz" \
-O "Python-${PYTHON_VERSION}.tgz"

# Extract the source code
tar -xzf Python-$PYTHON_VERSION.tgz
cd Python-$PYTHON_VERSION || exit 1

export CFLAGS="${CFLAGS} -w"

# Configure the build
./configure
./configure >/dev/null || {
echo "配置失败!"
exit 1
}

# Compile and install
make -j "$(nproc)"
sudo make altinstall
make -j "$(nproc)" -s || exit 1
sudo make altinstall -s
sudo ln -s /usr/local/bin/python2.7 /usr/local/bin/python
sudo ln -s /usr/local/bin/python2.7 /usr/local/bin/python2
# Clean up
Expand Down

0 comments on commit 6c6c34f

Please sign in to comment.