码迷,mamicode.com
首页 > 其他好文 > 详细

pip 部署

时间:2016-01-06 11:36:45      阅读:535      评论:0      收藏:0      [点我收藏+]

标签:

使用环境: centos 6.6  and  python 2.6

 

1、安装:

pip 包在epel 的yum 源中首先安装epel:

[root@kvm ~]# yum list|grep epel
epel-release.noarch                      6-8                            extras  
[root@kvm ~]# yum install epel-release

然后安装python-pip

yum install python-pip

安装完成后,即可使用pip 命令

[root@kvm Flask]# pip -V
pip 1.3.1 from /usr/lib/python2.6/site-packages (python 2.6)

 

2、修改pip 源:

使用pip官方源发现被墙了,如下:

[root@kvm ~]# pip install virtualenv
Downloading/unpacking virtualenv

  Could not fetch URL https://pypi.python.org/simple/virtualenv/: There was a problem confirming the ssl certificate: <urlopen error _ssl.c:477: The handshake operation timed out>
  Will skip URL https://pypi.python.org/simple/virtualenv/ when looking for download links for virtualenv
  Could not fetch URL https://pypi.python.org/simple/: There was a problem confirming the ssl certificate: <urlopen error _ssl.c:477: The handshake operation timed out>
  Will skip URL https://pypi.python.org/simple/ when looking for download links for virtualenv
  Cannot fetch index base URL https://pypi.python.org/simple/
  Could not fetch URL https://pypi.python.org/simple/virtualenv/: There was a problem confirming the ssl certificate: <urlopen error _ssl.c:477: The handshake operation timed out>
  Will skip URL https://pypi.python.org/simple/virtualenv/ when looking for download links for virtualenv
  Could not find any downloads that satisfy the requirement virtualenv
No distributions at all found for virtualenv
Storing complete log in /root/.pip/pip.log

于是修改为国内豆瓣源:  http://pypi.douban.com/simple/

查看文档: /usr/share/doc/python-pip-1.3.1/docs/configuration.txt 可得:

配置文件路径: * On Unix and Mac OS X the configuration file is: :file:`$HOME/.pip/pip.conf`

修改路径写法:

The names of the settings are derived from the long command line option, e.g.
if you want to use a different package index (``--index-url``) and set the
HTTP timeout (``--default-timeout``) to 60 seconds your config file would
look like this:

.. code-block:: ini

    [global]
    timeout = 60
    index-url = http://download.zope.org/ppix

 

于是,写在/root/.pip/pip.conf 文件为:

   [global]
    timeout = 60
    index-url = http://pypi.douban.com/simple/

 

测试:

[root@kvm Flask]# pip install virtualenv
Downloading/unpacking virtualenv
  Downloading virtualenv-13.1.2.tar.gz (1.7MB): 1.7MB downloaded
  Running setup.py egg_info for package virtualenv
    warning: no previously-included files matching ‘*‘ found under directory ‘docs/_templates‘
    warning: no previously-included files matching ‘*‘ found under directory ‘docs/_build‘
Installing collected packages: virtualenv
  Running setup.py install for virtualenv
    warning: no previously-included files matching ‘*‘ found under directory ‘docs/_templates‘
    warning: no previously-included files matching ‘*‘ found under directory ‘docs/_build‘
    Installing virtualenv script to /usr/bin
    Installing virtualenv-2.6 script to /usr/bin
Successfully installed virtualenv
Cleaning up...

 

至此,pip已经可以正常使用

 

3、pip 参数说明

后续再补充,嘿嘿

 

pip 部署

标签:

原文地址:http://www.cnblogs.com/lowry-zhuang/p/5104690.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!