zoukankan      html  css  js  c++  java
  • linux下easy_install的安装与使用详解

    Python中的easy_install工具用起来非常好用,它的作用类似于Php中的pear,或者Ruby中的gem,或者Perl中的cpan。

    1.easy_install安装

    如果想使用easy_install工具,需要先安装setuptools,不过更酷的方法是使用ez_setup.py脚本:
    执行如下命令:

    1
    2
    shell#  wget -q http://peak.telecommunity.com/dist/ez_setup.py
    shell#  python ez_setup.py

    安装完后,最好确保easy_install所在目录已经被加到PATH环境变量里:

    Linux: /usr/local/bin

    比如说要安装Python的MySQL支持,可以执行如下命令,系统会自动在pypi网站列表里查找相关软件包:

    1
    easy_install MySQL-python

    通过easy_install安装软件,相关安装信息会保存到easy-install.pth文件里,路径类似如下形式:

    Linux:/usr/local/lib/python25/site-packages/easy-install.pth

    如果想删除通过easy_install安装的软件包,比如说:MySQL-python,可以执行命令:

    1
    easy_install -m MySQL-python

    此操作会从easy-install.pth文件里把MySQL-python的相关信息抹去,剩下的egg文件,你可以手动删除。

    2.easy_install使用详解

    方法一:
      根据你想要的安装包名来进行easy_install,工具会检索网页查询最新版本的包,自动下载、构建和安装

    1
    easy_install MySQL-python

    方法二:
      指定网址来更新或安装,类似使用一,多了个参数-f和用来指定页面的地址只指定页面地址

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

    方法三:
      只使用网址来easy_install安装

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

    方法四
      easy_install安装下载好的egg文件(egg文件是用setup tools打包的压缩文件)

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

    方法五:
      升级包,有时候你需要更新包的版本

    1
    easy_install --upgrade PyProtocols
  • 相关阅读:
    圣诞树
    删除临时表并且插入数据
    sql语句中查询用in的时候,按in的顺序来输出
    xmlhelper and excelhelper
    几个小知识点。
    根据页面上记录数和页面大小获取总页数
    SQL语句的疑问
    katie melua the closest thing to crazy
    something about table
    little things
  • 原文地址:https://www.cnblogs.com/paranoia/p/6178701.html
Copyright © 2011-2022 走看看