pip是python的包管理工具,pip库中自带了很多python的开源工具包,在使用的时候直接运行pip install就可以下载并安装注册到python模块内,下文将会讨论centos中如何安装pip。
一、安装pip命令
下载pip安装包:
[root@web1 xxx]# wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4.2.tar.gz
解压tar包:
[root@web1 xxx]# tar -vxf setuptools-1.4.2.tar.gz
进入解压包,并运行安装命令:
[root@web1 xxx]# cd setuptools-1.4.2 [root@web1 xxx]# python2.7 setup.py install
安装完成后,最后安装pip:
[root@web1 xxx]# easy_install-2.7 pip
检测是否已经安装成功:
[root@web1 xxx]# pip --version pip 1.2 from /usr/local/lib/python2.7/site-packages/pip-1.2-py2.7.egg (python 2.7)
二、pip常用命令
1、查看pip使用帮助:
[root@web1 xxx]# pip help Usage: pip COMMAND [OPTIONS] --version show program's version number and exit -h,--help Show help -v,--verbose Give more output -q,--quiet Give less output --log <FILENAME> Log file where a complete (maximum verbosity) record will be kept --proxy <PROXY> Specify a proxy in the form user:passwd@proxy.server:port. Note that the user:password@ is optional and required only if you are behind an authenticated proxy. If you provide user@proxy.server:port then you will be prompted for a password. --timeout <SECONDS> Set the socket timeout (default 15 seconds) --exists-action <EXISTS_ACTION> Default action when a path already exists. Use this option more than one time to specify another action if a certain option is not available. Choices: (s)witch,(i)gnore,(w)ipe,(b)ackup Commands available: bundle: Create pybundles (archives containing multiple packages) freeze: Output all currently installed packages (exact versions) to stdout help: Show available commands install: Install packages search: Search PyPI uninstall: Uninstall packages unzip: Unzip individual packages zip: Zip individual packages
2、pip安装python包
[root@web1 xxx]# pip install 安装包名
3、pip卸载已安装的包
[root@web1 xxx]# pip uninstall 包名
4、其它常用命令
freeze: 查看已经安装的python包 help: FAQ查看pip帮助 search: Search PyPI unzip: 解压一个包 zip: 压缩一个已经安装的包原文链接:https://www.f2er.com/centos/381831.html