使用easy_install安装python包的方法 与python开源库
2016-03-09 11:50
716 查看
首先安装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:
Note that you will may need to invoke the command with superuser privileges toinstall to the system Python:
Alternatively, Setuptools may be installed to a user-local path:
(一般第二个方法可以)
安装好之后使用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:
Example 2. Install or upgrade a package by name and version by findinglinks on a given "download page":
Example 3. Download a source distribution from a specified URL,automatically building and installing it:
Example 4. Install an already-downloaded .egg file:
Example 5. Upgrade an already-installed package to the latest versionlisted on PyPI:
Example 6. Install a source distribution that's already downloaded andextracted in the current directory (New in 0.5a9):
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 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
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
相关文章推荐
- Python求算数平方根和约数的方法汇总
- 【python】编程语言入门经典100例--28
- python的moudles文件中__all__作用
- IP地址正则表达式匹配方法
- python的常用概念
- Python——debug(二)
- python 调用 lvs 脚本 [备忘]
- python脚本工具-2 去除扩展名后提取目录下所有文件名并保存
- 用PyInstaller把Python代码打包成单个独立的exe可执行文件
- Ubuntu14.0 64bit 下Scrapy爬虫框架的搭建
- Python基础--快速改造:字符串
- python批量验证apk渠道包脚本
- python 上传下载文件
- python真的还蛮可爱的(*^__^*)
- python逐个读取txt字符修改过后放到另一个txt文件中
- python学习笔记二--列表的使用
- 今天开始学习python
- python类、对象、方法、属性之类与对象
- 【OpenStack】OpenStack系列1之Python虚拟环境搭建
- python之import机制