005_解决pip国外安装源慢的问题

用默认的pip安装源pypi.python.org由于在国外经常会出现超时的问题,而且安装速度极其的慢,如下图中的超时问题=>

一、可通过以下方式解决。

cat  ~/.pip/pip.conf 
[global]
timeout = 60     #设置超时时间
index-url = http://pypi.douban.com/simple         #设置国内的镜像源,还有其他国内的源可以从网上进行搜索

二、

pip install salt-api==0.8.4.1
Collecting salt-api==0.8.4.1
  The repository located at pypi.douban.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host pypi.douban.com'.
根据上面的提示pip安装的时候加上后面的参数,如下:
pip install salt-api==0.8.4.1 --trusted-host pypi.douban.com
或通过requirements文件进行软件的批量安装
pip install -r requirements.txt --trusted-host pypi.douban.com
Requirement already satisfied (use --upgrade to upgrade): simplegeneric==0.8.1 in /root/python_dev/.pyenv/versions/2.7.1/lib/python2.7/site-packages (from -r requirements.txt (line 1))
Collecting singledispatch==3.4.0.3 (from -r requirements.txt (line 2))
  Downloading http://pypi.douban.com/packages/3.4/s/singledispatch/singledispatch-3.4.0.3-py2.py3-none-any.whl
。。。。。。。。。。
发现通过上面的方式速度快了很多,也没有上面出现的超时问题了



 

posted @ 2016-03-24 18:59  arun_python  阅读(3389)  评论(0编辑  收藏  举报