linux中安装pip

In this tutorial, we’ll go over the steps to install pip in Linux. The pip command allows us to install Python packages from the Python Package Index or PyPI.

在本教程中,我们将介绍在Linux中安装pip的步骤。 pip命令允许我们从Python Package Index或PyPI安装Python软件包。

The pip command can be installed with the package manager for your Linux distribution. In this tutorial, we’ll work with Ubuntu’s apt package manager to install pip.

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

什么是Python PIP? (What is Python PIP?)

The pip command stands for Package Installer for Python. Similar to the apt command for Debian-based distributions, yum and rpm commands for Red Hat-based distributions, and pacman for Arch-based distributions, pip command helps install packages for Python.

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

When you’re working with Python, you can install the available packages using the system’s default package manager or work with pip to install Python-specific packages directly from their official index.

使用Python时,您可以使用系统的默认软件包管理器来安装可用的软件包,或者与pip一起直接从其官方索引中安装特定于Python的软件包。

With the default package manager, there will always be packages that just aren’t available. But with pip, you can rest assured that most of the packages that you’ll require (and many more) will be available right there.

使用默认的程序包管理器,总是会有一些不可用的程序包。 但是,有了pip,您可以放心,所需的大多数软件包(以及更多软件包)都将在那里提供。

如何在Linux中安装Pip? (How To Install Pip In Linux?)

So how do we go about installing pip in Linux? It’s really simple. Let’s walk through the simple steps to get pip up and running on our Ubuntu server here.

那么,如何在Linux中安装pip? 真的很简单。 让我们通过简单的步骤在此处的Ubuntu服务器上启动并运行。


root@ubuntu:~# apt -y install python-pip
OR
root@ubuntu:~# apt -y install python3-pip
Python3 Pip Installation
Python3 Pip安装

If you’re using a different distribution of Linux, there’s nothing to worry about. Simply change the apt install part with your package manager.

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

For example, on an Arch-based system, you’d type

例如,在基于Arch的系统上,您可以输入


root@arch:~# pacman -S python2-pip
root@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

linux中安装pip_如何在Linux中安装PIP相关推荐

  1. linux python安装pip_如何在Linux中安装Pip

    Pip是用于Python的软件包管理系统,用于安装和管理以Python编写的软件包. Pip是类似工具,如bundle,npm,另一种编程语言的作曲家. 步骤1 - 安装PIP 您可以使用两种方法安装 ...

  2. ubuatu 安装pip_如何在Ubuntu上安装pip

    pip 是一个命令行工具,允许你安装 Python 编写的软件包. 学习如何在 Ubuntu 上安装 pip 以及如何使用它来安装 Python 应用程序. 有许多方法可以在 Ubuntu 上安装软件 ...

  3. linux fish颜色配置,如何在 Linux 中安装、配置和使用 Fish Shell?

    (给Linux爱好者加星标,提升Linux技能) 英文:Magesh Maruthamuthu,翻译:Linux中国/MK linux.cn/article-10622-1.html 每个 Linux ...

  4. linux查看图像大小_如何在Linux上调整一批图像的大小?

    linux查看图像大小 Resizing images on Linux with gThumb is easy. However, I have a batch of images inside a ...

  5. caffe-gpu ubuntu 安装_如何在Linux中安装vnStat和vnStati监视网络流量

    VnStat是针对Linux和BSD的基于控制台的网络流量监视工具设计.它将保留所选网络接口的网络流量日志.为了生成日志,vnStat使用内核提供的信息. 换句话说,它不会嗅探网络流量,并且可以确保系 ...

  6. ubuntu 安装yum_如何在 Linux 中安装微软的 .NET Core SDK | Linux 中国

    本分步操作指南文章解释了如何在 Linux 中安装 .NET Core SDK 以及如何使用 .NET 开发出第一个应用程序.-- Sk致谢译自 | ostechnix.com 作者 | Sk译者 | ...

  7. linux内核如何安装vim,如何在Linux 中安装和使用 PacVim?

    描述 你好,Vim用户!今天,我偶然发现了一个很酷的程序来提高 Vim 的使用技巧.Vim 是编写和编辑代码的绝佳编辑器.然而,你们中的一些人(包括我)仍在陡峭的学习曲线中挣扎.再也不用了!来看看 P ...

  8. linux mint安装类型,如何在Linux Mint 16中正确安装Ubuntu One

    由于Linux Mint是基于 Ubuntu 的,所以我认为 Ubuntu One 应该是预装程序之一.不过我错了.我自行从 Software Manager 安装了 Ubuntu One,令我惊讶的 ...

  9. linux动画制作软件,如何在Ubuntu中安装2D动画软件OpenToonz

    OpenToonz,开源2D动画软件,现在可以通过Snap软件包轻松安装在Ubuntu 16.04,Ubuntu 18.04及更高版本中. OpenToonz基于Toonz Studio Ghibli ...

最新文章

  1. spring全局异常抓取validation校验信息
  2. C语言-运算符优先级及注意事项
  3. 计算机应用基础 pdf 陈建军教案,温州市第二职业中等专业学校(温五中) 教学资源 温州市《计算机应用基础》学业水平测试考纲(转发)...
  4. 简约几何艺术海报PSD分层模板,即使简单也足以控制观众的注意力。
  5. 程序、进程与线程的关系
  6. 学习 openssl 证书命令
  7. 《统一沟通-微软-实战》-7-配置-2-呼叫寄存
  8. JavaScript对滚动条的操作
  9. 小米9pro MIUI11.12.19 简化代码 布局随切 核心CPU 黑域
  10. java房屋租赁系统源码,基于jsp+mysql+Spring开发,免费分享
  11. JAVA实现字体扩大代码_[Java教程]jQuery实现设置字体大小代码实例
  12. 联合概率分布与边缘分布
  13. php开发bt种子,[原创作品][PHP]BT种子打包推送小神器~~
  14. css全局加粗,CSS 实现矩形四个边角加粗的方法
  15. java中vo_java中的vo是什么
  16. 计算机中取消打印任务,取消打印任务的具体方法步骤
  17. php post 验证,php模拟post提交微信验证码,总是提交不上去
  18. Transformer 实现 Kaggle 房价预测竞赛
  19. html5音乐和歌词同步,HTML5实现歌词同步
  20. QQ浏览器保存网页为mhtml文件

热门文章

  1. Eureka主动下线机制
  2. 大疆无人机安卓Mobile Sdk开发(一)简单介绍
  3. 开源SDP 软件定义边界环境的安装和搭建
  4. Unity微信聊天框界面制作
  5. Nacos命名空间与配置分组
  6. Java基本数据类型转换与java基本类型转换优先级
  7. Matlab RANSAC提取圆柱(非内置函数)
  8. 解决网络上有重名问题
  9. CDH6.3.2 集成 tez0.9.1
  10. GoJS中Panels的Table元素