python安装第三方库的3种方法

【方法一】: 通过setuptools来安装python模块

首先下载 http://peak.telecommunity.com/dist/ez_setup.py

note: 最好下载个setuptools,本人是15.2版本,里面包含了ez_setup

运行 python ez_setup.py

d:\work\installation\setuptools-15.2\setuptools-15.2>python ez_setup.py > 1.txt
extracting in c:\users\admini~1\appdata\local\temp\tmpbxikxf
now working in c:\users\admini~1\appdata\local\temp\tmpbxikxf\setuptools-15.2
installing setuptools
……
copying setuptools-15.2-py2.7.egg to c:\python27\lib\site-packages
setuptools 15.2 is already the active version in easy-install.pth
installing easy_install-script.py script to c:\python27\scripts
installing easy_install.exe script to c:\python27\scripts
installing easy_install-2.7-script.py script to c:\python27\scripts
installing easy_install-2.7.exe script to c:\python27\scripts
installed c:\python27\lib\site-packages\setuptools-15.2-py2.7.egg
processing dependencies for setuptools==15.2
finished processing dependencies for setuptools==15.2

运行 easy_install py

d:\work>easy_install py #py 为第三方库文件
searching for py
best match: py 1.4.26
adding py 1.4.26 to easy-install.pth file
using c:\python27\lib\site-packages
processing dependencies for py
finished processing dependencies for py

【方法二】: 通过pip来安装python模块

安装 easy_install pip

d:\work>easy_install pip
searching for pip
best match: pip 6.1.1
processing pip-6.1.1-py2.7.egg
pip 6.1.1 is already the active version in easy-install.pth
installing pip-script.py script to c:\python27\scripts
installing pip.exe script to c:\python27\scripts
installing pip2.7-script.py script to c:\python27\scripts
installing pip2.7.exe script to c:\python27\scripts
installing pip2-script.py script to c:\python27\scripts
installing pip2.exe script to c:\python27\scripts
using c:\python27\lib\site-packages\pip-6.1.1-py2.7.egg
processing dependencies for pip
finished processing dependencies for pip

运行 pip install xlrd

usage:
pip [options]
commands:
install install packages.
uninstall uninstall packages.
freeze output installed packages in requirements format.
list list installed packages.
show show information about installed packages.
search search pypi for packages.
wheel build wheels from your requirements.
zip deprecated. zip inpidual packages.
unzip deprecated. unzip inpidual packages.
help show help for commands.
general options:
-h, –help show help.
–isolated run pip in an isolated mode, ignoring
environment variables and user configuration.
-v, –verbose give more output. option is additive, and can be
used up to 3 times.
-v, –version show version and exit.
-q, –quiet give less output.
–log path to a verbose appending log.
–proxy specify a proxy in the form
[user:passwd@]proxy.server:port.
–retries maximum number of retries each connection should
attempt (default 5 times).
–timeout set the socket timeout (default 15 seconds).
–exists-action default action when a path already exists:
(s)witch, (i)gnore, (w)ipe, (b)ackup.
–trusted-host mark this host as trusted, even though it does
not have valid or any https.
–cert path to alternate ca bundle.
–client-cert path to ssl client certificate, a single file
containing the private key and the certificate
in pem format.
–cache-dir store the cache data in .
–no-cache-dir disable the cache.
–disable-pip-version-check
don’t periodically check pypi to determine
whether a new version of pip is available for
download. implied with –no-index.

【方法三】:直接从网上下载下可执行文件来安装.

比如说,去 >>> pythonlibs

Posted in 未分类