Speed Up Python Package Installs: Manage PyPI Mirrors with Oh My Zsh Plugin
This guide explains how to use a dedicated Oh My Zsh plugin to quickly switch and test PyPI mirror sources, improving package download speed for Python developers, especially in China, with step‑by‑step installation, usage commands, and a comprehensive list of supported mirrors.
Choosing an appropriate PyPI mirror can significantly speed up package downloads, especially for users in China where network issues may cause slow installs. This article introduces a plugin designed for Oh My Zsh that simplifies managing and switching PyPI mirrors.
Plugin Overview
The PyPI plugin is a simple yet powerful tool built for Oh My Zsh users. It provides commands to quickly switch between different PyPI mirrors and test their connectivity.
Repository: https://github.com/belingud/pypi
Installation Steps
Install via Git
Open a terminal and clone the plugin repository into Oh My Zsh's custom plugins directory:
git clone https://github.com/belingud/pypi ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/pypiEdit the ~/.zshrc file and add the plugin to the plugin list: plugins=(... pypi ...) After saving, reload the Zsh configuration:
source ~/.zshrcHow to Use
List Available Mirrors
Run pypi list to see all supported PyPI mirrors and their URLs.
pypi listSwitch to a Specific Mirror
Use pypi use <shortname>, where <shortname> is the alias of the mirror. For example, to use Alibaba Cloud's mirror:
pypi use aliyunTest Mirror Connectivity
Check a mirror's reachability with pypi ping <shortname|url>. Examples:
pypi ping tsinghua pypi ping https://pypi.org/simple/Supported Mirrors
pypi: https://pypi.org/simple/
al iyun 阿里云
tencent 腾讯
huawei 华为
163 网易
volces 火山
cernet 中国教科研网校园联合镜像站
ts inghua 清华大学
sustech 南方科技大学
bfsu 北京外国语大学
nju 南京大学
dnui 大连东软信息学院
pku 北京大学
njtech 南京工业大学
nyist 南阳理工
sjtu 上海交大
zju 浙江大学
jlu 吉林大学
testpypiMirrors that are only accessible within a campus intranet are not supported.
Notes
Ensure the short name you enter when switching mirrors is valid.
Use the ping command to verify a mirror's availability before switching.
Getting Help
For detailed usage of each command, add -h or --help to the command, e.g.:
pypi use -hConclusion
With the PyPI plugin, you can easily manage and switch PyPI mirrors. For more information or questions, visit the plugin's GitHub page.
Python Programming Learning Circle
A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
