Skip to content

Commit

Permalink
Linux: add pip mirror
Browse files Browse the repository at this point in the history
  • Loading branch information
ananosleep committed Mar 25, 2024
1 parent 7b680a1 commit 8a16435
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions install_linux_mac.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ python3 -m venv myenv
# Activate the virtual environment
source myenv/bin/activate

# Ping google to decide if use mirror
target_url="www.google.com"
timeout=3000
ping -c 1 -W $timeout $target_url -w 3 > /dev/null

if [ $? -ne 0 ]; then
echo "Use CN"
export PIP_DISABLE_PIP_VERSION_CHECK=1
export PIP_NO_CACHE_DIR=1
export PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
else
echo "Use default"
fi

# Upgrade pip to the latest version
pip install --upgrade pip

Expand Down

0 comments on commit 8a16435

Please sign in to comment.