首页 > 编程知识 正文

python第三库安装方法记录,python安装第三方库的方法三

时间:2023-12-28 11:57:08 阅读:328329 作者:UUIO

本文目录一览:

python如何安装库

python如何安装库?

python安装第三方库的方法:

首先我们打开电脑上的命令解释器程序(windows+r),输入cmd,具体如图所示:

推荐:《Python教程》

现在我们可以进行第三方库的安装,先安装numpy库(提供数组支持,以及相应的高效的处理函数),具体如图所示:

接着安装scipy库(提供矩阵支持,以及矩阵相关的数值计算模块),具体如图所示:

再接着我们可以安装matplotpb库(可视化工具、作图库),具体如图所示:

最后安装pandas库(强大、灵活的数据分析和探索工具),具体如图所示:

注意事项

安装第三方库必须保证网络连接通畅以上就是小编分享的关于python如何安装库的详细内容希望对大家有所帮助,更多有关python教程请关注环球青藤其它相关文章!

Python第三方库怎么安装

假设你安装了python(如果未安装,则运行sudo apt-get install python-dev) 下面以安装PIL库为例 下载Imaging-1.1.7.tar.gz源码包2. cd Imaging-1.1.7/ python setup.py build sudo python setup.py install

Python第三方库安装?

你的图片太花了,看不到几个字母。

不过,你这个问题描述,也能大致理解是什么情况。建议做如下处理试一下:

(1)找到你的 Python 安装目录,找到下面的 site-packages 文件夹,这个文件夹用于存放第三方库,而且也是环境变量路径(如果你在安装Python时勾选了写入环境变量的话,如果没有就自己加入进去即可);

(2)将你自己的库文件放到这个文件夹里;

(3)之后就可以像使用其他库一样使用了,如import sys这种的;

(4)注意记住你自己的库文件名,且不要与已有第三方库和标准库重名。

python怎么安装第三方类库

使用pip

大多数库都可以通过pip安装,安装方法为,在命令行窗口输入

pip install libname

libname为库名

某些库通过pip安装不了,可能是因为没有打包上传到pypi中,可以下载安装包之后离线安装,方法是

pip install libpath

libpath为本地安装包地址,这些安装包一般以whl为后缀名。表示python扩展包的windows环境下的二进制文件。

有一个专门下载这种文件的地方,是由加利福尼亚大学的师生为方便python用户使用而建立的,并非官方出品,使用时需自行承担风险。

源文件安装

如果下载下来的安装包为带有源文件的压缩包,解压之后,运行setup.py进行安装,方法是

命令行切换到安装包中setup.py文件所在的目录,执行 python setup.py install

运行安装包

有些类库提供了双击运行直接安装的安装包,比如python连接mysql数据库的驱动 mysql-connector-python

这些安装包的后缀名为msi或者exe。下载下来之后,双击运行之后就安装好了,前提是要根据python的版本及windows的位数下载对应的安装包,否则安装过程会报错或者直接提示无法安装。

python 第三方库怎么安装

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

首先下载

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

运行 python ez_setup.py

D:workinstallationsetuptools-15.2setuptools-15.2python ez_setup.py 1.txt

Extracting in c:usersadmini~1appdatalocaltemptmpbxikxf

Now working in c:usersadmini~1appdatalocaltemptmpbxikxfsetuptools-15.2

Installing Setuptools

......

Copying setuptools-15.2-py2.7.egg to c:python27libsite-packages

setuptools 15.2 is already the active version in easy-install.pth

Installing easy_install-script.py script to C:Python27Scripts

Installing easy_install.exe script to C:Python27Scripts

Installing easy_install-2.7-script.py script to C:Python27Scripts

Installing easy_install-2.7.exe script to C:Python27Scripts

Installed c:python27libsite-packagessetuptools-15.2-py2.7.egg

Processing dependencies for setuptools==15.2

Finished processing dependencies for setuptools==15.2

运行 easy_install py

D:workeasy_install py #py 为第三方库文件

Searching for py

Best match: py 1.4.26

Adding py 1.4.26 to easy-install.pth file

Using c:python27libsite-packages

Processing dependencies for py

Finished processing dependencies for py

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

安装 easy_install pip

D:workeasy_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:Python27Scripts

Installing pip.exe script to C:Python27Scripts

Installing pip2.7-script.py script to C:Python27Scripts

Installing pip2.7.exe script to C:Python27Scripts

Installing pip2-script.py script to C:Python27Scripts

Installing pip2.exe script to C:Python27Scripts

Using c:python27libsite-packagespip-6.1.1-py2.7.egg

Processing dependencies for pip

Finished processing dependencies for pip

运行 pip install xlrd

Usage:

pip command [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 individual packages.

unzip DEPRECATED. Unzip individual 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 Path to a verbose appending log.

--proxy proxy Specify a proxy in the form

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

--retries retries Maximum number of retries each connection should

attempt (default 5 times).

--timeout sec Set the socket timeout (default 15 seconds).

--exists-action action Default action when a path already exists:

(s)witch, (i)gnore, (w)ipe, (b)ackup.

--trusted-host hostname Mark this host as trusted, even though it does

not have valid or any HTTPS.

--cert path Path to alternate CA bundle.

--client-cert path Path to SSL client certificate, a single file

containing the private key and the certificate

in PEM format.

--cache-dir dir Store the cache data in dir.

--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 网站,提供了很多Python非官方包下载,二进制文件,下载安装方便.

Python中如何安装第三方库

1,使用python自带的pip管理器进行安装

2,使用第三方库自带的安装程序进行安装

3,有些库直接拷贝到库目录就能使用。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。