easy_install 安装使用

安装easy_install的目的:

python安装第三方库一般有两种方式:

  1:普通安装

    下载压缩包,解压出来,找到setup.py文件

    命令行下使用

    X:\解压路径下> python setup.py install

  2:使用easy_install安装

    用于安装egg扩展名的包,egg可以认为就是zip,只是扩展名不同。

    在命令行上 指定包的名称(会搜索PyPI)、指定包文件的网上路径、本地文件路径、当前目录 进行安装和更新

    X:\> easy_install 路径

    例如:要安装python的mongoDB驱动,命令行中输入瑞星啊命令

       easy_install pymongo即可自动匹配安装合适的pymongo

所以安装easy_install有助于简化python第三方库的安装。

 

easy_install在windows下的安装:

  下载安装包
  http://pypi.python.org/pypi/setuptools
  找到当前最新版的压缩包[注意:针对win7,64bit有特别要求,见下边]
  下载,解压,直到找到里边的 setup.py 
  命令行下定位到那个目录中进行安装:
  X:\解压路径下> python setup.py install,自动安装..\Python27\Scripts\,会看到里边有easy_install.exe
  把此路径加到系统变量path中,以便在任何地方使用easy_install命令
 
     注意:win7 64位必须使用ez_setup.py进行安装。方法是下载ez_setup.py后,在cmd下执行 python ez_setup.py,即可自动安装setuptools。目前没有直接的exe安装      版本。本人win8.1,64bit,按理说应该也是按此方式安装,但执行 python ez_setup.py安装时一直会出错。后来本人使用上边的方法成功。
 
参考:http://www.cnblogs.com/zhuyp1015/archive/2012/07/17/2596495.html
   http://simpledeveloper.com/how-to-install-easy_install/
     
 
 

Downloading and Installing a Package

 easy_install使用的 一些例子

For basic use of easy_install, you need only supply the filename or URL of a source distribution or .egg file (Python Egg).

Example 1. Install a package by name, searching PyPI for the latest version, and automatically downloading, building, and installing it:

easy_install SQLObject 

Example 2. Install or upgrade a package by name and version by finding links on a given "download page":

easy_install -f http://pythonpaste.org/package_index.html SQLObject 

Example 3. Download a source distribution from a specified URL, automatically building and installing it:

easy_install http://example.com/path/to/MyPackage-1.2.3.tgz 

Example 4. Install an already-downloaded .egg file:

easy_install /my_downloads/OtherPackage-3.2.1-py2.3.egg 

Example 5. Upgrade an already-installed package to the latest version listed on PyPI:

easy_install --upgrade PyProtocols 

Example 6. Install a source distribution that's already downloaded and extracted in the current directory (New in 0.5a9):

easy_install . 

Example 7. (New in 0.6a1) Find a source distribution or Subversion checkout URL for a package, and extract it or check it out to ~/projects/sqlobject (the name will always be in all-lowercase), where it can be examined or edited. (The package will not be installed, but it can easily be installed with easy_install ~/projects/sqlobject. See Editing and Viewing Source Packages below for more info.):

easy_install --editable --build-directory ~/projects SQLObject 
 

 

posted @ 2014-02-26 22:00  Sungyou_Yu  阅读(965)  评论(0编辑  收藏  举报