Loading... ### pip篇 #### 提高依赖安装速度 pip默认的软件安装源为官方源 地址为:`https://pypi.org/simple/` 国内访问速度较慢,建议更换为国内的pip源镜像。 注意:新版Ubuntu强制要求使用https源 ###### 国内源 清华:`https://pypi.tuna.tsinghua.edu.cn/simple` 阿里云:`http://mirrors.aliyun.com/pypi/simple/` 中国科技大学:`https://pypi.mirrors.ustc.edu.cn/simple/` 华中理工大学:`http://pypi.hustunique.com/` 山东理工大学:`http://pypi.sdutlinux.org/` 豆瓣:`http://pypi.douban.com/simple/` ###### 临时使用 pip -i 指定的源地址 所需安装的软件 **示例:** ``` pip install -i https://pypi.tuna.tsinghua.edu.cn/simple urllib3==1.25.8 ``` ###### 永久修改 人在国内推荐直接采用这种办法,一劳永逸。 * Linux下,修改 `/root/.pip/pip.conf` (没有就创建一个文件夹及文件。文件夹要加`.`,表示是隐藏文件夹) * Windows下,直接在user目录中创建一个pip目录,如:`C:\Users\XX\pip`,新建文件`pip.ini`。(其中`XX`为你所使用系统安装时设定的用户名称,;例如我的为`C:\Users\Francis\pip`) 在 `pip.conf` 或 `pip.ini` 中填入如下文件,该文件为示例 ``` [global] index-url = http://mirrors.aliyun.com/pypi/simple/ [install] trusted-host = mirrors.aliyun.com ``` 如果速度不理想,可更换其他源,将 `index-url` 中的地址更换为其他地址,并将 `trusted-host` 替换为该源的对应地址串,参照示例格式。 Last modification:September 19th, 2021 at 10:47 am © 允许规范转载 Support 逢年过节,欢迎投喂 Appreciate the author 支付宝微信