使用easy_install安装python包的方法 与python开源库

首先安装easy_install

easy_install 是 setuptools里的一个组件

安装easy_install 即是安装setuptools

链接https://pypi.python.org/pypi/setuptools


Download ez_setup.py and run it using the target Python version. The scriptwill download the appropriate version and install it for you:

> wget https://bootstrap.pypa.io/ez_setup.py -O - | python

Note that you will may need to invoke the command with superuser privileges toinstall to the system Python:

> wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python

Alternatively, Setuptools may be installed to a user-local path:

> wget https://bootstrap.pypa.io/ez_setup.py -O - | python - --user
(一般第二个方法可以)


安装好之后使用easy_install 安装 

方法如下

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

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

easy_install SQLObject

Example 2. Install or upgrade a package by name and version by findinglinks 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 versionlisted on PyPI:

easy_install --upgrade PyProtocols

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

easy_install .

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

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

Easy Install accepts URLs, filenames, PyPI package names (i.e., distutils"distribution" names), and package+version specifiers. In each case, it willattempt to locate the latest available version that meets your criteria.

When downloading or processing downloaded files, Easy Install recognizesdistutils source distribution files with extensions of .tgz, .tar, .tar.gz,.tar.bz2, or .zip. And of course it handles already-built .eggdistributions as well as .win32.exe installers built using distutils.

By default, packages are installed to the running Python installation'ssite-packages directory, unless you provide the -d or --install-diroption to specify an alternative directory, or specify an alternate locationusing distutils configuration files. (See Configuration Files, below.)

By default, any scripts included with the package are installed to the runningPython installation's standard script installation location. However, if youspecify an installation directory via the command line or a config file, thenthe default directory for installing scripts will be the same as the packageinstallation directory, to ensure that the script will have access to theinstalled package. You can override this using the -s or --script-diroption.

Installed packages are added to an easy-install.pth file in the installdirectory, so that Python will always use the most-recently-installed versionof the package. If you would like to be able to select which version to use atruntime, you should use the -m or --multi-version option.

原文链接

http://peak.telecommunity.com/DevCenter/EasyInstall#installing-easy-install


大量的开源库 Python Package Index

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值