1、在合适的系统寻找合适的环境配置文件。不存在的话需要自己新建一个。
Configuration
Config file
pip allows you to set all command line option defaults in a standard inistyle config file.
The names and locations of the configuration files vary slightly acrossplatforms. You may have per-user, per-virtualenv or site-wide (shared amongstall users) configuration:
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/ApplicationSupport/pip/pip.conf
. - On Windows the configuration file is
%APPDATA%\pip\pip.ini
.
There are also a legacy per-user configuration file which is also respected,these are located at:
- On Unix and macOS the configuration file is:
$HOME/.pip/pip.conf
- On Windows the configuration file is:
%HOME%\pip\pip.ini
You can set a custom path location for this config file using the environmentvariablePIP_CONFIG_FILE
.
2、使用以下配置项
[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com
3、重启pip。成功加速安装。