国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

python中提高pip install速度

2020-02-15 21:12:27
字體:
供稿:網(wǎng)友

pip install命令默認是用的是python官方源,由于一些客觀原因,連接速度很慢,甚至超時中斷,到時很多模塊安裝不上,甚是苦惱!

怎么辦?

使用國內(nèi)鏡像源,將以下命令完成拷貝出來,粘貼至記事本中,保存為bat文件,雙擊執(zhí)行該批處理文件。

@echo offrem 聲明采用UTF-8編碼chcp 65001echo /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*echo 自動設(shè)置pip安裝配置文件echo /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*set pipFolder=//pip//if exist %userprofile%%pipFolder% (echo 目錄%userprofile%%pipFolder%已存在無需創(chuàng)建) else (echo 創(chuàng)建%userprofile%%pipFolder%md %userprofile%%PiPFolder%)cd %userprofile%%pipFolder%echo /[global/]>pip.ini(echo timeout=60echo index-url=http://pypi.douban.com/simpleecho extra-index-url=https://pypi.tuna.tsinghua.edu.cn/simple/echo /[install/]echo trusted-host=pypi.douban.comecho pypi.tuna.tsinghua.edu.cnecho timeout = 10)>>pip.iniwmic ENVIRONMENT where "name='path' and username='<system>'"set VariableValue="%path%;%userprofile%%pipFolder%pip.ini"

然后再試試pip install命令,絕對飛一般的感覺。

另外給大家一些常用的pip國內(nèi)源:

阿里云 https://mirrors.aliyun.com/pypi/simple/ 
中國科技大學(xué) https://pypi.mirrors.ustc.edu.cn/simple/ 
豆瓣(douban) https://pypi.douban.com/simple/ 
清華大學(xué) https://pypi.tuna.tsinghua.edu.cn/simple/ 
中國科學(xué)技術(shù)大學(xué) https://pypi.mirrors.ustc.edu.cn/simple/

使用方法

臨時生效
使用時加上參數(shù) -i

如:

pip install matplotlib -i https://mirrors.aliyun.com/pypi/simple/

永久生效

1.Linux下,修改 ~/.pip/pip.conf (沒有就創(chuàng)建一個文件夾及文件。文件夾要加“.”,表示是隱藏文件夾)

內(nèi)容如下:

[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
 
[install]
trusted-host=mirrors.aliyun.com

2.windows下,直接在user目錄中創(chuàng)建一個pip目錄,如:C:/Users/xx/pip,新建文件pip.ini。內(nèi)容同上。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 阿克| 天全县| 巨野县| 门源| 永登县| 青神县| 博乐市| 平阴县| 巫溪县| 海阳市| 永州市| 江北区| 剑川县| 越西县| 资兴市| 明光市| 花莲市| 黄平县| 凌源市| 伊宁市| 洛川县| 望奎县| 黄平县| 陕西省| 仁怀市| 崇礼县| 夏河县| 乌拉特前旗| 同心县| 滦南县| 祥云县| 禹城市| 荆门市| 芜湖市| 乡宁县| 唐山市| 巨野县| 平原县| 莲花县| 鄂托克旗| 连平县|