pip 部署

使用环境: centos 6.6  and  python 2.6

1、安装:

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

[[email protected] ~]# yum list|grep epel
epel-release.noarch                      6-8                            extras  
[[email protected] ~]# yum install epel-release

然后安装python-pip

yum install python-pip

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

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

2、修改pip 源:

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

[[email protected] ~]# 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/

测试:

[[email protected] 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 参数说明

后续再补充,嘿嘿

时间: 2024-10-13 01:11:33

pip 部署的相关文章

python版本升级及pip部署方法

Python版本升级 CentOS 6.3自带的Python版本为2.6,首先需要升级到2.7版本.由于旧版本的Python已被深度依赖,所以不能卸载原有的Python,只能全新安装. 1.下载Python-2.7.4.tgz wget http://python.org/ftp/python/2.7.4/Python-2.7.4.tgz 2. 解压安装,命令如下: 1 tar -xvf Python-2.7.4.tgz 2 cd Python-2.7.4 3 ./configure --pre

如何部署Django

Note: Django 1.7.1 需要Python2.7 或者更高版本 1. 使用 pip 部署Django 1.1 下载pip , 链接:https://bootstrap.pypa.io/get-pip.py 1.2 安装pip, python get-pip.py 1.3 安装Django, pip install Django==1.7.1 1.4 检验是否安装成功 >>>import django >>>django.get_version() >&

python下安装 setuptools 和pip(python环境刚部署好)

起因:换了一台电脑,部署python环境,练习爬虫.然而,还没开始敲代码,就先安装各种第三方包,就想到了pip 安装利器. 官网下载好了pip压缩包,解压后在pip目录下执行命令:python setup.py install,报错提示:缺少setuptools 文件t.接着就开始搞setuptools,一番折腾,终于搞定. 特意将操作的过程记录下来. 1.setupstools 下载安装 官网下载:https://pypi.org/project/setuptools/0.9.8/ 安装路径:

有关pip的部署的几个命令

生成virtualenv的requirement.txtpip freeze > requirements.txt 安装requirement.txtpip install -r requirements.txt windows下批量pip升级的脚本for /F "delims===" %i in ('pip freeze -l') do pip install -U %i

ansible部署(pip安装)

centos7 pip安装 ansible 首先ansible基于python2.X 环境 默认centos都已经安装好了python2环境 安装可选性 ansible可以通过源码,yum,pip等方式安装本文采用pip安装方式 centos默认没有安装pip,这里我们要安装pip 参考文献:传送门 1 curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py 2 3 python get-pip.py 4 5 [root@localhost

linux中部署django项目

通过Nginx部署Django(基于ubuntu) Django的部署可以有很多方式,采用nginx+uwsgi的方式是其中比较常见的一种方式. 在这种方式中,我们的通常做法是,将nginx作为服务器最前端,它将接收WEB的所有请求,统一管理请求.nginx把所有静态请求自己来处理(这是NGINX的强项).然后,NGINX将所有非静态请求通过uwsgi传递给Django,由Django来进行处理,从而完成一次WEB请求. 可见,uwsgi的作用就类似一个桥接器.起到桥梁的作用. Linux的强项

跨过Nginx上基于uWSGI部署Django项目的坑

先说说他们的关系,Nginx和uWSGI都是Web服务器,Nginx负责静态内容,uWSGI负责Python这样的动态内容,二者配合共同提供Web服务以实现提高效率和负载均衡等目的.uWSGI实现了多个协议,如WSGI,HTTP协议,还有它自己的uwsgi协议,想了解更多关于uWSGI和uwsgi协议内容可以查阅这里.这样和fastcgi类似,请求和响应的流程如下: Request > Nginx > uWSGI > Django > uWSGI > Nginx > R

Ubuntu apache2 wsgi 部署django

在ubuntu上部署django其实还算简单直观,最重要的问题就是路径设置正确. 一,安装python 和django.这个很简单,django用pip安装就可以.就不解释了. 二,安装apache2 和 wsgi. 这里用的是apt-get. sudo apt-get insall apache2 sudo apt-get install libapache2-mod-wsgi 需要注意的是,如果之前安装配置过apache2的并且配置很乱,无法修复,建议还是完全卸载之后在安装.完全卸载的命令:

CentOS6.7部署Python Web环境

安装基础编译环境 yum install wget gcc make -y 在Python官网下载源码包 wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz 解包,解压缩 xz -d Python-3.6.2.tar.xz tar -xvf Python-3.6.2.tar 安装环境依赖包 yum install zlib-devel readline-devel ncurses-devel sqlite-devel