pip使用國內源加速下載

pip install 『包名』 -i 『網址』

如:

import os
command = "pip install  opencv-contrib-python -i http://pypi.mirrors.ustc.edu.cn/simple
os.system(command)

『網址』中的內容可以是以下站點:

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

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

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

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

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

 

如果報錯

可以使用:

import os
command = "pip install  opencv-contrib-python -i http://pypi.mirrors.ustc.edu.cn/simple --trusted-host pypi.mirrors.ustc.edu.cn"
os.system(command)

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章