臨時修改pypi鏡像源方法:
轉移到國內源地址:
阿里雲 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/
安裝時候指定國內源:
pip install pkg_name(包名) -i http://pypi.douban.com/simple/
當你遇到這樣的問題的時候(沒有就跳過)
pypi.douban.com is not a trusted or secure host and is being ignored.
解決辦法需要加信任:
pip install pkg_name(包名) -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
永久修改pypi鏡像源方法:
-
在C盤中找到目錄: C:\Users\用戶名\AppData\Roaming
-
查看在Roaming文件夾下新建pip文件夾(如果已經存在就跳過此步)
-
在pip文件夾中創建一個pip.ini文件
-
使用記事本的方式打開pip.ini文件,寫入:
[global]
index-url=http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
或者
[global]
timeout = 6000
index-url = http://pypi.douban.com/simple/
trusted-host = pypi.douban.com
然後就可以了