Fundamentals 4 min read

Speed Up Python Package Installs: Switch pip to Fast Chinese Mirrors

This guide explains why pip downloads from overseas are slow, lists reliable Chinese mirror URLs, and shows both temporary and permanent methods to configure pip on Windows, Linux, and macOS for faster package installation.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Speed Up Python Package Installs: Switch pip to Fast Chinese Mirrors

When developing in Python, the default pip repositories located abroad often cause slow download speeds or time‑outs.

Switching pip to a domestic mirror can dramatically improve installation performance.

Recommended Chinese Mirrors

Aliyun: https://mirrors.aliyun.com/pypi/simple/

Douban: https://pypi.douban.com/simple/

Tsinghua University: https://pypi.tuna.tsinghua.edu.cn/simple/

University of Science and Technology of China: http://pypi.mirrors.ustc.edu.cn/simple/

How to Change the Source?

1. Temporary Mirror Change

Use the -i option with the desired mirror URL when installing a package.

pip3 install numpy -i https://pypi.douban.com/simple/

The command installs the package from the specified mirror.

E:\....>pip3 install numpy -i https://pypi.douban.com/simple/
Looking in indexes: https://pypi.douban.com/simple/
Collecting numpy
  Downloading https://pypi.doubanio.com/packages/.../numpy-1.16.4-cp37-cp37m-win32.whl (10.0 MB)
    100% |████████████████████████████████| 10.0 MB 2.9 MB/s
Installing collected packages: numpy
Successfully installed numpy-1.16.4

2. Permanent Configuration (Windows)

Open %APPDATA%, create a folder named pip if it does not exist, and inside it create pip.ini with the following content (example uses Douban mirror):

[global]
timeout = 6000
index-url = https://pypi.douban.com/simple/
trusted-host = pypi.douban.com

After saving, pip will always use the configured mirror.

pip.ini configuration screenshot
pip.ini configuration screenshot

Testing the configuration shows that running pip3 install numpy now pulls packages from the Douban mirror:

E:\....>pip3 install numpy
Looking in indexes: https://pypi.douban.com/simple/
Collecting numpy
  Using cached https://pypi.doubanio.com/packages/.../numpy-1.16.4-cp37-cp37m-win32.whl
Installing collected packages: numpy
Successfully installed numpy-1.16.4

3. Permanent Configuration (Linux/macOS)

Create or edit the file ~/.pip/pip.conf and add the same configuration lines as above.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxWindowsInstallationpipmirrorspackage-management
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.