1. 程式人生 > 程式設計 >pip install 使用國內映象的方法示例

pip install 使用國內映象的方法示例

對於Python開發使用者來講,PIP安裝軟體包是家常便飯。但國外的源下載速度實在太慢,浪費時間。而且經常出現下載後安裝出錯問題。所以把PIP安裝源替換成國內映象,可以大幅提升下載速度,還可以提高安裝成功率。

國內源:

新版ubuntu要求使用https源,要注意。

清華:https://pypi.tuna.tsinghua.edu.cn/simple

中國科技大學 https://pypi.mirrors.ustc.edu.cn/simple/

阿里雲:http://mirrors.aliyun.com/pypi/simple/

華中理工大學:http://pypi.hustunique.com/

山東理工大學:http://pypi.sdutlinux.org/

豆瓣:http://pypi.douban.com/simple/

臨時使用:

可以在使用pip的時候加引數-i https://pypi.tuna.tsinghua.edu.cn/simple

例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyspider,這樣就會從清華這邊的映象去安裝pyspider庫。

永久修改,一勞永逸:

Linux下,修改 ~/.pip/pip.conf (沒有就建立一個資料夾及檔案。資料夾要加“.”,表示是隱藏資料夾)

內容如下:

[global]

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

[install]

trusted-host=mirrors.aliyun.com

windows下,直接在user目錄中建立一個pip目錄,如:C:\Users\xx\pip,新建檔案pip.ini。內容同上。

PyCharm使用國內源安裝:

File---Settings---Project:XXX---Project Interpreter

pip install 使用國內映象的方法示例

pip install 使用國內映象的方法示例

pip install 使用國內映象的方法示例

新增完成後你就可以在PyCharm上通過國內映象源進行下載;

到此這篇關於pip install 使用國內映象的示例程式碼的文章就介紹到這了,更多相關pip install 國內映象內容請搜尋我們以前的文章或繼續瀏覽下面的相關文章希望大家以後多多支援我們!