pip 部署
2016-01-06 10:35
316 查看
使用环境: 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[/code]
于是,写在/root/.pip/pip.conf (若没有目录则使用mkdir -p /root/.pip 创建一个)文件为:[global] timeout = 60 index-url = http://pypi.douban.com/simple/[/code]
测试:[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 参数说明
后续再补充,嘿嘿
相关文章推荐
- Hadoop年度回顾与2016发展趋势
- LeetCode之双指针(1)
- Sublime Text 3 快捷键汇总
- sql server 与oracle 中字段类型的对应
- RTP payload type
- C#委托的详细使用
- linux下创建和删除软、硬链接
- C Primer Plus3-4
- WebService的两种方式SOAP和REST比较 (转)
- IOS实现BLE后台通信
- css3 html5命名规范
- 2015年个人收获-成果、经验分享(项目经理、集成资质、网站开发、服务器等)
- 项目重构 ----修改xml文件中的包名
- Android GLSurfaceView学习(1):屏幕清理程序,使用随机颜色刷屏
- C Primer Plus3-2
- C Primer Plus3-3
- 看人生
- over(Partition by…) 一个超级好用的特有(开窗)函数。
- 如何在生产中成功运用Docker
- C Primer Plus3-1