安卓安装python第三方库_python安装第三方库的方法(一般方式、easy

python安装第三方库的方法(一般方式、easy_install方式),有需要的朋友可以参考下。

一、一般方式

下载压缩包,解压出来,找到setup.py文件,命令行下使用:

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

完成后查看:

F:\Python25\Lib\site-packages\

下面,会多一个目录

然后在 解释器里可以使用 import 目录名

有些不是直接目录名的

如 .egg 结尾的目录,会找里面除 EGG-INFO 外的另一个目录名,可以 import 这个目录名

二、easy_install方式

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

使用文档

http://peak.telecommunity.com/DevCenter/EasyInstall

下载

http://pypi.python.org/pypi/setuptools

找到当前最新版 0.6c9 的压缩包

下载,解压,直到找到 setup.py

命令行下定位到那个目录中进行安装:

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

会安装到

F:\Python25\Scripts\

把这个路径追加到 系统环境变量 PATH 中

也可以 找到 ez_setup.py

X:\解压路径下> ez_setup.py

这样会根据情况下载最新的easy_install

easy_install的一些用法

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

X:\> easy_install 路径

http://peak.telecommunity.com/DevCenter/EasyInstall

Downloading and Installing a Package

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

例1. Install a package by name, searching PyPI for the latest version, and automatically downloading, building, and installing it: 代码如下: easy_install SQLObject

例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

例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

例4. Install an already-downloaded .egg file: 代码如下: easy_install /my_downloads/OtherPackage-3.2.1-py2.3.egg

例5. Upgrade an already-installed package to the latest version listed on PyPI: 代码如下: easy_install --upgrade PyProtocols

例6. Install a source distribution that's already downloaded and extracted in the current directory (New in 0.5a9): 代码如下: easy_install .

例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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值