pip安裝python庫時使用國內鏡像資源加速下載過程


pip默認安裝包是從網站https://pypi.org/simple下載,我們可以將其改成國內的鏡像網站,加速下載過程,下面以安裝numpy庫為例:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy

下載其它庫時,將numpy改成需要的庫名即可。(使用pip、pip2 or pip3根據指向的python版本即可確定。)

 

在終端中輸入pip install -help可以發現參數"-i"的作用:

Package Index Options:
  -i, --index-url <url>       Base URL of Python Package Index (default
                              https://pypi.org/simple). This should point to a
                              repository compliant with PEP 503 (the simple
                              repository API) or a local directory laid out in
                              the same format.

 

清華鏡像資源:

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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM