一次性python换源可以添加-i选项:
pip install 包名 -i http://源地址
保存为设置文件pip.conf:
官方文档:User Guide - pip documentation v21.1.3 (pypa.io)
https://pip.pypa.io/en/stable/user_guide/#configuration
pip允许将所有的默认选项保存为一个ini格式的配置文件pip.conf
---------以下来源于官方文档------------------
Per-user:
-
On Unix the default configuration file is:
$HOME/.config/pip/pip.conf
which respects theXDG_CONFIG_HOME
environment variable. -
On macOS the configuration file is
$HOME/Library/Application Support/pip/pip.conf
if directory$HOME/Library/Application Support/pip
exists else$HOME/.config/pip/pip.conf
. -
On Windows the configuration file is
%APPDATA%\pip\pi