首页 > 编程知识 正文

kali安装python3,linux 安装python

时间:2023-05-04 11:14:28 阅读:24721 作者:4852

在linux上安装pip

In this tutorial,we’llgooverthestepstoinstallpipinlinux.thepipcommandallowsustoinstallpythonpackagesfromthepythonpackageininux

本教程介绍了在Linux上安装pip的过程。 可以使用pip命令从Python软件包索引或PyPI安装Python软件包。

thepipcommandcanbeinstalledwiththepackagemanagerforyourlinuxdistribution.in this tutorial,we’llworkwithubuntu’sapt packagage

pip命令可以与Linux发行版软件包管理器一起安装。 在本教程中,您将与Ubuntu的apt软件包管理器一起安装pip。

什么是Python PIP? (What is Python PIP? ) thepipcommandstandsforpackageinstallerforpython.similartotheaptcommandfordebian -基础分布,yumandrpmcommmandsfordebian andpacmanforarch-based distributions,pipcommandhelpsinstallpackagesforpytions

pip命令表示Python的软件包安装程序。 与基于Debian的发行版apt命令、基于Red Hat的发行版yum和rpm命令以及基于Arch的发行版pacman一样,pip命令有助于安装Python软件包。

when you’reworkingwithpython,youcaninstalltheavailablepackagesusingthesystem’sdefaultpackagemanagerorworkwithpiptoinstalagtal

使用Python时,可以使用系统的默认软件包管理器安装可用软件包,也可以直接通过官方索引与pip一起安装特定于Python的软件包。

With the default package manager,therewillalwaysbepackagesthatjustaren’tavailable.butwithpip,youcanrestassuredthatmostofthofthp

使用默认软件包管理器时,总是有不可用的软件包。 但是,请放心,有了pip,几乎所有必需的软件包(以及更多的软件包)都将在那里提供。

如何在Linux上安装pip (how to install pip in Linux? ) sohowdowegoaboutinstallingpipinlinux? it’sreallysimple.let’swalkthroughthesimplestepstogetpipupandrunningonubuntuserverhere。

那么,如何在Linux上安装pip? 真的很简单。 用简单的步骤在这里的Ubuntu服务器上启动并运行吧。

root@Ubuntu:~# apt-yinstallpython-piporroot @ Ubuntu :~apt-yinstallpython3- pip python3pipinstallation python3pip安装if you’reuss there’snothingtoworryabout.simplychangethe http://www.Sina.com/partwithyourpackagemanager。

如果您使用的是其他发行版的Linux,则无需担心。 您只需使用软件包管理器修改apt install的部分。

For example,on an arch -基系统,you’dtype

例如,基于

Arch的系统上,您可以输入

root@arch:~# pacman -S python2-piproot@arch:~# pacman -S python-pip #This installs python3 pip

You can use python-pip (for python version 2) and python3-pip (for python version 3).

您可以使用python-pip(适用于python版本2)和python3-pip(适用于python版本3)。

Depending on which version of Python you’re working with, you can install pip or pip3 and make sure that you have the right packages being installed.

根据您使用的Python版本,可以安装pip或pip3并确保已安装正确的软件包。

如何在Linux中使用PIP命令? (How to Use PIP Command in Linux?)

Now coming to the usage of PIP, we’ll learn how to

现在开始使用PIP,我们将学习如何

install

安装 uninstall

卸载 search

搜索 list existing packages

列出现有软件包 show details of a package

显示包裹的细节

I’ve installed python3-pip on Ubuntu since I mostly work with Python 3.x. You can replace the pip3 part in the below examples with pip if you’re working with pip for Python 2.x.

因为我主要使用Python 3.x,所以我已经在Ubuntu上安装了python3-pip。 如果您正在使用适用于Python 2.x的pip,则可以将以下示例中的pip3部分替换为pip。

We’ll install the numpy library as an example here.

我们将在此处安装numpy库作为示例。

root@ubuntu:~# pip3 install <package name>For Example --root@ubuntu:~# pip3 install numpy Pip Install Example 点安装示例

If you would like to know what packages are available, you can use the search functionality of the pip command.

如果您想知道可用的软件包,可以使用pip命令搜索功能。

root@ubuntu:~# pip3 search numpy Pip Search Example 点搜索示例

How to find the list of installed Python packages? We’ll use the list option for the pip command.

如何找到已安装的Python软件包列表? 我们将对pip命令使用list选项。

root@ubuntu:~# pip3 list Pip List Example 点列表示例

You can safely ignore the warning in the output because it’s just to let us know that the default output format will change in the future.

您可以放心地忽略输出中的警告,因为这只是为了告诉我们默认输出格式将来会更改。

If you’d like to know more about a package that you’ve installed, just use the show command.

如果您想了解有关已安装软件包的更多信息,请使用show命令。

root@ubuntu:~# pip3 uninstall numpy Pip Show Example 点显示示例

And to uninstall a package, we simply use pip3 uninstall <package name> as below.

要卸载软件包,我们只需使用pip3卸载 <package name>,如下所示。

root@ubuntu:~# pip3 uninstall numpy Pip Uninstall Example 点卸载示例 结论 (Conclusion)

I know, it was really easy to install pip in Linux so I took the liberty to explain how you can start with using the command right away. As you work with Python, you’ll find yourself working with the pip command very often for installing and uninstalling packages.

我知道,在Linux中安装pip真的很容易,所以我自由地解释了如何立即使用该命令。 使用Python时,您会发现自己经常使用pip命令来安装和卸载软件包。

We hope you enjoyed this tutorial!

希望您喜欢本教程!

翻译自: https://www.journaldev.com/33905/install-pip-linux

linux中安装pip

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