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.confwhich respects theXDG_CONFIG_HOMEenvironment 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。成功加速安装。
本文介绍了如何通过配置pip来加速Python包的安装过程。主要内容包括:寻找或创建配置文件、设置国内镜像源及可信主机,最后重启pip完成加速配置。
3822

被折叠的 条评论
为什么被折叠?



