• 【转】使用setuptools简化Python模块的安装


    转自:http://blog.ihipop.info/2010/10/1719.html

    如果说Perl用户 一定熟悉 CPAN,那么Python用户一定熟悉setuptools

    默认activePython已经集成了这个工具,如果没有,可以在这里下载http://pypi.python.org/pypi/setuptools#downloads

    用法:

    cd /d E:\Python26\Scripts

    easy_install 模块名

    软件会自动联网下载安装,linux用法一样。

    更多知识,参见IBM知识库 http://www.ibm.com/developerworks/cn/linux/l-cppeak3.html


    实例 :安装SQLObject

    E:\Python26\Scripts>easy_install SQLObject
    install_dir E:\Python26\Lib\site-packages\
    Searching for SQLObject
    Reading http://pypi.python.org/simple/SQLObject/
    Reading http://sqlobject.org
    Reading http://sqlobject.org/
    Reading http://sqlobject.org/devel/
    Best match: SQLObject 0.14.0
    Downloading http://pypi.python.org/packages/2.6/S/SQLObject/SQLObject-0.14.0-py2
    .6.egg#md5=7ec52e2783cacf4edd714f16734a0d4e
    Processing SQLObject-0.14.0-py2.6.egg
    creating e:\python26\lib\site-packages\SQLObject-0.14.0-py2.6.egg
    Extracting SQLObject-0.14.0-py2.6.egg to e:\python26\lib\site-packages
    Adding SQLObject 0.14.0 to easy-install.pth file
    Installing sqlobject-admin script to E:\Python26\Scripts
    Installed e:\python26\lib\site-packages\sqlobject-0.14.0-py2.6.egg
    Processing dependencies for SQLObject
    Searching for FormEncode>=1.1.1
    Reading http://pypi.python.org/simple/FormEncode/
    Reading http://formencode.org
    Reading http://formencode.sf.net
    Best match: FormEncode 1.2.3dev
    Downloading http://pypi.python.org/packages/source/F/FormEncode/FormEncode-1.2.3
    dev.tar.gz#md5=c89a70812098bdeed27dc7c41be4f51e
    Processing FormEncode-1.2.3dev.tar.gz
    Running FormEncode-1.2.3dev\setup.py -q bdist_egg --dist-dir c:\docume~1\admini~
    1\locals~1\temp\easy_install-cqnpss\FormEncode-1.2.3dev\egg-dist-tmp-p0kxxb
    warning: no files found matching '*.py' under directory '.'
    warning: no files found matching '*.html' under directory 'docs'
    no previously-included directories found matching '**\.svn'
    Adding formencode 1.2.3dev to easy-install.pth file
    Installed e:\python26\lib\site-packages\formencode-1.2.3dev-py2.6.egg
    Finished processing dependencies for SQLObject

    然后 在Python里面import sqlobject 就可以使用了。

    安装PyQuery也同理:(a jquery-like library for python)

    C:\Users\ihipop>easy_install PyQuery
    install_dir D:\Python26\Lib\site-packages\
    Searching for PyQuery
    Reading http://pypi.python.org/simple/PyQuery/
    Reading http://www.bitbucket.org/olauzanne/pyquery/
    Reading http://www.bitbucket.org/olauzanne/pyquery
    Best match: pyquery 0.6.1
    Downloading http://pypi.python.org/packages/source/p/pyquery/pyquery-0.6.1.zip#m
    d5=348de0ff03451ef69f3a1098242c548c
    Processing pyquery-0.6.1.zip
    Running pyquery-0.6.1\setup.py -q bdist_egg --dist-dir c:\users\ihipop\appdata\l
    ocal\temp\easy_install-stx4dh\pyquery-0.6.1\egg-dist-tmp-g7vrmw
    Adding pyquery 0.6.1 to easy-install.pth file

    Installed d:\python26\lib\site-packages\pyquery-0.6.1-py2.6.egg
    Processing dependencies for PyQuery
    Searching for lxml>=2.1
    Reading http://pypi.python.org/simple/lxml/
    Reading http://codespeak.net/lxml
    Best match: lxml 2.3beta1
    Downloading http://pypi.python.org/packages/2.6/l/lxml/lxml-2.3beta1-py2.6-win32
    .egg#md5=d4dafc94ae9543661e4c5722496d923d
    Processing lxml-2.3beta1-py2.6-win32.egg
    creating d:\python26\lib\site-packages\lxml-2.3beta1-py2.6-win32.egg
    Extracting lxml-2.3beta1-py2.6-win32.egg to d:\python26\lib\site-packages
    Adding lxml 2.3beta1 to easy-install.pth file

    Installed d:\python26\lib\site-packages\lxml-2.3beta1-py2.6-win32.egg
    Finished processing dependencies for PyQuery

    完毕,多方便啊,这是一个python的小型包管理器了。
     
     
    ---------------------------------------------------------------------------------------------------------------
     
    Windows下安装setuptools:http://pypi.python.org/pypi/setuptools#windows

    Windows

    32-bit version of Python
    Install setuptools using the provided .exe installer.
    64-bit versions of Python
    Download ez_setup.py and run it; it will download the appropriate .egg file and install it for you. (Currently, the provided .exe installer does not support 64-bit versions of Python for Windows, due to a distutils installer compatibility issue
  • 相关阅读:
    NOIp2016 D2T3 愤怒的小鸟【搜索】(网上题解正解是状压)
    NOIp2018D1T1 积木大赛 【思维】
    NOIp2018D1T2 货币系统【分析&完全背包】
    NOIp2017D1T2 时间复杂度【模拟】
    NOIp2015D1T3 斗地主【暴搜】
    NOIp2013D2T3 华容道【搜索&图论-最短路】
    Andrew算法求二维凸包-学习笔记
    最小割的一些小技巧(实用小干货)
    USACO4.3 Buy Low, Buy Lower【简单dp·高精度】
    iOS本地推送与远程推送详解
  • 原文地址:https://www.cnblogs.com/fzzl/p/2845379.html
Copyright © 2020-2023  润新知