初学 Python,老是提示缺乏各类各样的 Python 包,因而了解了下 Python 的包安装管理工具: python
1.setuptools 中的 easy_install (Download, build, install, upgrade, and uninstall Python packages -- easily!) git
easy_install 是 setuptools 包里的一个命令,因此想使用 easy_install 就得安装 setuptools 。 github
①能够直接下载setuptools-0.6c11.win32-py2.7.exe文件安装 工具
下载地址:http://pypi.python.org/pypi/setuptools ui
安装完成以后在 Python 安装目录下的 Scripts 目录下就会有 easy_install.exe,将 Scripts 加到Path 变量里,就可使用它来安装 Python 包了,只须要将包名做为参数,它就会自动到 Pypi 里去查找并安装,例如: spa
easy_install SQLObject
②经过下载 ez_setup.py 脚本安装 setuptools code
脚本下载地址:http://peak.telecommunity.com/dist/ez_setup.py orm
安装效果应该是和方法①是同样的(可是这里下载的是setuptools-0.6c11-py2.7.egg),不过根据官网的文档,对于 64 位的机器,只能使用第二种方式进行安装。 ip
2.pip(a tool for installing and managing Python packages, a replacement for easy_install) md5
pip 的安装须要 setuptools 或者 distribute 若是你使用的是 Python3.x 那么就只能使用distribute 由于 Python3.x 不支持 setuptools 。
能够经过脚本 get-pip.py 来安装 pip,脚本下载地址:
https://raw.github.com/pypa/pip/master/contrib/get-pip.py
下载后执行便可安装 pip 。
安装完成以后相关的命令程序,一样会放到 Python 安装路径下的 Scripts 目录下,而后就能够用以下方式安装相关的包:
pip install SomePackage
听说 pip 是 easy_install 的替代品,初学 Python,体会得不够深入,期待后期补充,下面是 pip官网上对 pip 与 easy_install 进行的比较:
pip is meant to improve on easy_install. Some of the improvements:
pip doesn’t do everything that easy_install does. Specifically:
pip is complementary with virtualenv, and it is encouraged that you use virtualenv to isolate your installation.