雲服務器環境配置下載慢

在服務器上配置環境,幾十M的資源都會超時
方法一:
設置超時時間
windows下在cmd中,linux在終端下輸入如下命令:

pip --default-timeout=100 install -U pip

方法二:

設置國內鏡像
新版ubuntu要求使用https源,要注意。

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

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

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

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

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

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

  1. 臨時使用

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

例如:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyspider`
  1. 永久修改

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。內容同上。
方法三:離線安裝
下載whl文件再通過Xftp傳輸然後安裝,可以先在服務器上安裝,出現download ”文件名“的時候使用CTRL+C停止進程,拿着這個文件名去搜索下載,儘量選擇官網。(文件名放在百度上通常搜不出來官網,建議換個方法搜索)
常用下載網址:
https://pypi.org/project/pip/這個網址可以搜索
https://pytorch.org/get-started/previous-versions/
https://tensorflow.google.cn/install/pip?lang=python3
https://mxnet.incubator.apache.org/get_started/download
https://pypi.org/project/opencv-python/#files

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