1.國內鏡像源: 阿里雲 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/ 2.臨時修改: 可以在使用pip的時候在后面加上-i參數,指定pip源 eg: pip install xxx -i http://pypi.douban.com/simple/--trusted-host pypi.douban.com #此參數“--trusted-host”表示信任,如果上一個提示不受信任,就使用這個 3.永久使用國內pypi鏡像安裝 1.Linux: cd ~/.pip # 運行此命令切換目錄,沒有此目錄創建 編輯 vim pip.conf 添加內容: [global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple [install] trusted-host = https://pypi.tuna.tsinghua.edu.cn # trusted-host 此參數是為了避免麻煩,否則使用的時候可能會提示不受信任 2.Window: 直接在當前用戶目錄中創建一個名為 pip 的文件夾如:C://User/xxx 接着在 pip 文件夾中創建一個名為 pip 的文本文件(后綴名由" .txt "改為 " .ini ") 添加內容: [global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple [install] trusted-host = https://pypi.tuna.tsinghua.edu.cn # trusted-host 此參數是為了避免麻煩,否則使用的時候可能會提示不受信任 4.正常使用pip命令: pip install xxx