解決python使用pip安裝下載庫出現錯誤:ERROR:Cannot unpack file xxxx情況
以scipy庫下載安裝為例,在命令行中直接輸入命令:pip install scipy 如果下載速度很慢,或者下載失敗,建議使用國內源下載。
使用清華大學鏡像源下載,輸入命令:pip install https://pypi.tuna.tsinghua.edu.cn/simple/scipy
詳細可以參考:解決pip下載慢問題 。
如果出現:ERROR:Cannot unpack file的情況,如下圖所示:
解決方法:使用命令:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn module_name 即可。
使用scipy庫進行示例:
等待下載完成,顯示安裝成功。
如果上面鏡像源沒有,可以嘗試其他國內源。
常用國內鏡像源:
阿里雲 http://mirrors.aliyun.com/pypi/simple/
中國科技大學 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣 http://pypi.douban.com/simple/