1. 程式人生 > >【python pip】一招解決pip下載過慢問題

【python pip】一招解決pip下載過慢問題

# 概述 在我們經常使用pip安裝外掛模組的時候,有沒有發現下載速度很慢,但有些有強迫症的人面對幾k幾十k每秒的速度絕對忍不了,是不是,那麼,方法來了。 @[TOC] # 壹:問題描述 一句話就是使用pip下載過慢,想要快起來,起來,來。 # 貳:解決過程 ## 一、問題分析 pip下載速度過慢的原因就是pip預設使用的是國外的映象源,那麼,我使用國內的映象源,問題不就解決了。 ## 二、問題解決 有兩種方法,方法一臨時有效,方法二永久生效。 ### 方法一:下載時加入引數`-i [映象源地址]` ``` pip install -i https://pypi.tuna.tsinghua.edu.cn/simple jieba 或者 pip install jieba -i https://pypi.tuna.tsinghua.edu.cn/simple ``` ### 方法二:設定源 使用方法一,需要每次在下載時都要帶引數,不想麻煩的試試方法二吧。 ``` pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple pip config set install.trusted-host mirrors.aliyun.com ``` ![](https://img-blog.csdnimg.cn/20200312204633456.png) ## 三、國內映象源地址 ``` # pip國內映象源。 # # 阿里雲 http://mirrors.aliyun.com/pypi/simple/ # 中國科技大學 https://pypi.mirrors.ustc.edu.cn/simple/ # 豆瓣 http://pypi.douban.com/simple # Python官方 https://pypi.python.org/simple/ # v2ex http://pypi.v2ex.com/simple/ # 中國科學院 http://pypi.mirrors.opencas.cn/simple/ # 清華大學 https://pypi.tuna.tsinghua.edu.cn/simple/ ``` # 叄:作者有話 更換源後,你的速度就能飛起來了。歪瑞谷的。 ---- # 作者 > 1、[作者個人網站](https://www.lomtom.top) > 2、[作者CSDN](https://blog.csdn.net/qq_41929184) > 3、[作者部落格園](https://www.cnblogs.com/lomtom/) > 4、[作者簡書](https://www.jianshu.com/u/fb248d