python pip安装

下载文件 wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate执行安装

python get-pip.py


centos 7,python2.7 安装python-MySQLdb,因是最小化安装,安装过程中需要依赖其他的工具或包

[root@localhost ~]# pipinstall mysql-python

报错:Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-Gme83P/mysql-python/

通过yum 安装以下两个包;


[root@localhost ~]# yum install mysql-devel

[root@localhost ~]# yum installpython-devel

再执行安装,出现以下报错,需要安装gcc编译工具,

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-U2yiQI/mysql-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-iogwbL-record/install-record.txt --single-version-externally-managed --compile"failed with error code 1 in /tmp/pip-build-U2yiQI/mysql-python/


[root@localhost ~]#yum install gcc

安装pip需要先装setuptools
https://pypi.python.org/pypi/setuptools 

[root@localhost setuptools-36.0.1]# pip install mysql-python

Collecting mysql-python

  Using cached MySQL-python-1.2.5.zip

Installing collected packages: mysql-python

  Running setup.py install for mysql-python ... done