Python如何安装第三方库?(python如何安装第三方库)

网友投稿 1306 2022-08-17

Python如何安装第三方库?(python如何安装第三方库)

Python如何安装第三方库?(python如何安装第三方库)

这篇文章主要介绍了Python安装第三方库的3种方法,本文讲解了通过setuptools来安装python模块、通过pip来安装python模块、直接从网上-下可执行文件来安装三种方法,需要的朋友可以参考下:

【方法一】: 通过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

Extractinginc:\users\admini~1\appdata\local\temp\tmpbxikxf

Now workinginc:\users\admini~1\appdata\local\temp\tmpbxikxf\setuptools-15.2

Installing Setuptools

......

Copying setuptools-15.2-py2.7.eggto c:\python27\lib\site-packages

setuptools15.2isalready the active versionineasy-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 dependenciesforsetuptools==15.2

Finished processing dependenciesforsetuptools==15.2

运行 easy_install py

D:\work>easy_install py #py 为第三方库文件

Searchingforpy

Best match: py1.4.26

Adding py1.4.26to easy-install.pthfile

Using c:\python27\lib\site-packages

Processing dependenciesforpy

Finished processing dependenciesforpy

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

安装 easy_install pip

D:\work>easy_install pip

Searchingforpip

Best match: pip6.1.1

Processing pip-6.1.1-py2.7.egg

pip6.1.1isalready the active versionineasy-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.exescript 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 dependenciesforpip

Finished processing dependenciesforpip

运行 pip install xlrd

Usage:

pip [options]

Commands:

install Install packages.

uninstall Uninstall packages.

freeze Output installed packagesinrequirementsformat.

list Listinstalled packages.

show Show information about installed packages.

search Search PyPIforpackages.

wheel Build wheelsfromyour requirements.

zip DEPRECATED.Zipindividual packages.

unzip DEPRECATED. Unzip individual packages.

help Showhelpforcommands.

General Options:

-h,--help Showhelp.

--isolated Run pipinan isolated mode, ignoring

environment variablesanduser configuration.

-v,--verbose Give more output. Optionisadditive,andcan be

used up to3times.

-V,--version Show versionandexit.

-q,--quiet Give less output.

--log Path to a verbose appending log.

--proxy Specify a proxyinthe form

[user:passwd@]proxy.server:port.

--retries Maximum number of retries each connection should

attempt (default5times).

--timeout Setthe socket timeout (default15seconds).

--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

nothave validoranyHTTPS.

--cert Path to alternate CA bundle.

--client-cert Path to SSL client certificate, a singlefile

containing the private keyandthe certificate

inPEMformat.

--cache-dir

--no-cache-dir Disable the cache.

--disable-pip-version-check

Don't periodically check PyPI to determine

whether a new version of pipisavailablefor

download. Implied with--no-index.

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

比如说,去 >>> pythonlibs <<< 网站,提供了很多Python非官方包-,二进制文件,-安装方便.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Python如何安装pygame模块?(pycharm怎么安装pygame模块)
下一篇:Python如何安装numpy模块?(Python如何安装numpy)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~