欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

python中提高pip install速度

 更新時(shí)間:2020年02月14日 09:50:14   作者:大眼睛編程  
本文給大家分享了如何提高pip install速度的方法,其實(shí)就是將默認(rèn)源替換為國(guó)內(nèi)高速的源,非常的簡(jiǎn)單實(shí)用,有需要的小伙伴可以參考下

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

怎么辦?

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

@echo off

rem 聲明采用UTF-8編碼chcp 65001

echo \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

echo 自動(dòng)設(shè)置pip安裝配置文件

echo \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

set pipFolder=\\pip\\

if exist %userprofile%%pipFolder% (

echo 目錄%userprofile%%pipFolder%已存在無(wú)需創(chuàng)建

) else (

echo 創(chuàng)建%userprofile%%pipFolder%

md %userprofile%%PiPFolder%

)

cd %userprofile%%pipFolder%

echo \[global\]>pip.ini

(

echo timeout=60

echo index-url=http://pypi.douban.com/simple

echo extra-index-url=https://pypi.tuna.tsinghua.edu.cn/simple/

echo \[install\]

echo trusted-host=pypi.douban.com

echo pypi.tuna.tsinghua.edu.cn

echo timeout = 10

)>>pip.ini

wmic ENVIRONMENT where "name='path' and username='<system>'"

set VariableValue="%path%;%userprofile%%pipFolder%pip.ini"

然后再試試pip install命令,絕對(duì)飛一般的感覺(jué)。

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

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

使用方法

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

如:

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

永久生效

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

內(nèi)容如下:

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

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

相關(guān)文章

最新評(píng)論