Commands for setup tuna pypi mirror #
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -U pip setuptools wheel
# write to $HOME/.config/pip/pip.conf
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# or from CQU mirror
pip config set global.index-url https://mirrors.cqu.edu.cn/pypi/web/simple
uninstall all
pip uninstall -y -r <(pip freeze)
configure by env #
https://pip.pypa.io/en/stable/topics/configuration/#environment-variables
命令行参数都可以用对应的环境变量来代替,如:--index
可以用 PIP_INDEX_URL
来代替。
pip & pyproject.toml #
用其他工具:
$ pip install pip-tools
$ python -m piptools compile -o requirements.txt pyproject.toml
$ pip install -r requirements.txt
https://github.com/pypa/pip/issues/7822