方法一:临时豆瓣源
使用参数
-i https://pypi.doubanio.com/simple/ –trusted-host pypi.doubanio.com
例如:
pip install django -i https://pypi.doubanio.com/simple/ --trusted-host pypi.doubanio.com
方法二:LInux下永久更换镜像源
# python3
cat << EOF > ~/.pip3
[global]
timeout = 6000
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com
EOF
# python2
cat << EOF > ~/.pip
[global]
timeout = 6000
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com
EOF
方法三:windowns 下永久更换镜像源
文档信息
- 本文作者:dzxindex
- 本文链接:https://dzxindex.github.io/2020/01/01/python-pip/
- 版权声明:自由转载-非商用-非衍生-保持署名(创意共享3.0许可证)