進行 pip install 時,安裝輪子訪問過慢而造成安裝失敗,有時候配置鏡像源仍會出現莫名其妙的問題,包括網絡代理問題等。看了一些解決方案,找出了一個最適合的方式,如下所示:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn package_you_want
比如,我要安裝scipy
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn scipy==1.7.1
安裝速度很快,完美解決。