Skip to main content

Pip

Preparation (Mandatory)

To ensure stable resolution of the package mirror, ensure the hosts file is configured with correct domain name resolution before configuration. If not added, add the following content to the /etc/hosts file before configuring the package mirror.

cat >> /etc/hosts << EOF
10.251.102.1 mirrors.shanhe.com
EOF

Pypi Package Mirror Usage Guide

The pypi mirror syncs every 5 minutes.

Temporary Use

pip install -i https://mirrors.shanhe.com/simple some-package

Note that 'simple' must not be omitted; use https, not http.

Set as Default

Configure after ensuring pip version (>=10.0.0):

pip install -i https://mirrors.shanhe.com/simple pip -U # Upgrade pip version; skip if already satisfied
pip config set global.index-url https://mirrors.shanhe.com/simple