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

有许多方法可以在 Ubuntu 上安装软件。 你可以从软件中心安装应用程序,也可以从下载的 DEB 文件、PPA(LCTT 译注:PPA 即 Personal Package Archives,个人软件包集)、Snap 软件包,也可以使用 Flatpak、使用 AppImage,甚至用旧的源代码安装方式。

还有一种方法可以在 Ubuntu 中安装软件包。 它被称为 pip,你可以使用它来安装基于 Python 的应用程序。

什么是 pip

pip 代表 “pip Installs Packages”。 pip 是一个基于命令行的包管理系统。 用于安装和管理 Python 语言编写的软件。

你可以使用 pip 来安装 Python 包索引(PyPI)中列出的包。

作为软件开发人员,你可以使用 pip 为你自己的 Python 项目安装各种 Python 模块和包。

作为最终用户,你可能需要使用 pip 来安装一些 Python 开发的并且可以使用 pip 轻松安装的应用程序。 一个这样的例子是 Stress Terminal 应用程序,你可以使用 pip 轻松安装。

让我们看看如何在 Ubuntu 和其他基于 Ubuntu 的发行版上安装 pip。

如何在 Ubuntu 上安装 pip

默认情况下,pip 未安装在 Ubuntu 上。 你必须首先安装它才能使用。 在 Ubuntu 上安装 pip 非常简单。 我马上展示给你。

Ubuntu 18.04 默认安装了 Python 2 和 Python 3。 因此,你应该为两个 Python 版本安装 pip。

pip,默认情况下是指 Python 2。pip3 代表 Python 3 中的 pip。

注意:我在本教程中使用的是 Ubuntu 18.04。 但是这里的教程应该适用于其他版本,如Ubuntu 16.04、18.10 等。你也可以在基于 Ubuntu 的其他 Linux 发行版上使用相同的命令,如 Linux Mint、Linux Lite、Xubuntu、Kubuntu 等。

为 Python 2 安装 pip

首先,确保已经安装了 Python 2。 在 Ubuntu 上,可以使用以下命令进行验证。

python2--version

如果没有错误并且显示了 Python 版本的有效输出,则说明安装了 Python 2。 所以现在你可以使用这个命令为 Python 2 安装 pip:

sudoapt install python-pip

这将安装 pip 和它的许多其他依赖项。 安装完成后,请确认你已正确安装了 pip。

pip--version

它应该显示一个版本号,如下所示:

pip9.0.1from/usr/lib/python2.7/dist-packages(python2.7)

这意味着你已经成功在 Ubuntu 上安装了 pip。

为 Python 3 安装 pip

你必须确保在 Ubuntu 上安装了 Python 3。 可以使用以下命令检查一下:

python3--version

如果显示了像 Python 3.6.6 这样的数字,则说明 Python 3 在你的 Linux 系统上安装好了。

现在,你可以使用以下命令安装 pip3:

sudoapt install python3-pip

你应该使用以下命令验证 pip3 是否已正确安装:

pip3--version

它应该显示一个这样的数字:

pip9.0.1from/usr/lib/python3/dist-packages(python3.6)

这意味着 pip3 已成功安装在你的系统上。

如何使用 pip 命令

现在你已经安装了 pip,让我们快速看一些基本的 pip 命令。 这些命令将帮助你使用 pip 命令来搜索、安装和删除 Python 包。

要从 Python 包索引 PyPI 中搜索包,可以使用以下 pip 命令:

pip search

例如,如果你搜索“stress”这个词,将会显示名称或描述中包含字符串“stress”的所有包。

pip search stress

stress(1.0.0)-A trivial utilityforconsuming system resources.

s-tui(0.8.2)-StressTerminalUI stresstestandmonitoring tool

stressypy(0.0.12)-A simple programforcalling stressand/orstress-ngfrompython

fuzzing(0.3.2)-Toolsforstress testing applications.

stressant(0.4.1)-Simplestress-testtool

stressberry(0.1.7)-StresstestsfortheRaspberryPi

mobbage(0.2)-A HTTP stresstestandbenchmark tool

stresser(0.2.1)-A large-scale stress testing framework.

cyanide(1.3.0)-Celerystress testingandintegrationtestsupport.

pysle(1.5.7)-Aninterfaceto ISLEX,a pronunciation dictionarywithstress markings.

ggf(0.3.2)-globalgeometric factorsandcorresponding stresses of the optical stretcher

pathod(0.17)-A pathological HTTP/S daemonfortestingandstressing clients.

MatPy(1.0)-A toolboxforintelligent material design,andautomaticyieldstress determination

netblow(0.1.2)-Vendoragnostic network testing framework to stress network failures

russtress(0.1.3)-Packagethat helps you to put lexical stressinrussian text

switchy(0.1.0a1)-A fastFreeSWITCHcontrol library purpose-built on traffic theoryandstress testing.

nx4_selenium_test(0.1)-ProvidesaPythonclassandapps which monitorand/orstress-testtheNoMachineNX4 webinterface

physical_dualism(1.0.0)-Pythonlibrary that approximates the natural frequencyfromstress via physical dualism,andvice versa.

fsm_effective_stress(1.0.0)-Pythonlibrary that uses the rheological-dynamical analogy(RDA)to compute damageandeffective buckling stressinprismatic shell structures.

processpathway(0.3.11)-A nifty little toolkit to create stress-free,frustrationless image processing pathwaysfromyour webcamforcomputer vision experiments.Orobserving yourcat.

如果要使用 pip 安装应用程序,可以按以下方式使用它:

pip install

pip 不支持使用 tab 键补全包名,因此包名称需要准确指定。 它将下载所有必需的文件并安装该软件包。

如果要删除通过 pip 安装的 Python 包,可以使用 pip 中的 uninstall 选项。

pip uninstall

你可以在上面的命令中使用 pip3 代替 pip。

【编辑推荐】

【责任编辑:庞桂玉 TEL:(010)68476606】

点赞 0

ubuatu 安装pip_如何在Ubuntu上安装pip相关推荐

  1. couchdb 安装_如何在Ubuntu上安装CouchDB –分步指南

    couchdb 安装 In this tutorial, we'll go over how to install CouchDB on Ubuntu. CouchDB is a NoSQL data ...

  2. linux deb文件安装_如何在 Ubuntu 上安装 VirtualBox | Linux 中国

    本新手教程解释了在 Ubuntu 和其他基于 Debian 的 Linux 发行版上安装 VirtualBox 的各种方法.-- Abhishek Prakash Oracle 公司的自由开源产品 V ...

  3. qt git linux 安装,git – 如何在Ubuntu上安装QtWebEngine

    当QML程序(例如,以太坊,在这种情况下为 installed from the PPA)试图 import QtWebEngine 1.0 import QtWebEngine.experiment ...

  4. pip安装deb_技术|如何在 Ubuntu 上安装 pip

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

  5. 如何在Ubuntu上安装GCC编译器

    如何在Ubuntu上安装GCC编译器 1.首先更新包列表 sudo apt update 2.安装build-essential软件包: sudo apt install build-essentia ...

  6. 如何在Ubuntu上安装最新版本的Node js

    如何在Ubuntu上安装最新版本的Node.js 作者:chszs,转载需注明.博客主页:http://blog.csdn.net/chszs Node.js是一个软件平台,通常用于构建大规模的服务器 ...

  7. ubuntu ftp服务器_如何在Ubuntu上安装FTP服务器?

    ubuntu ftp服务器 In this tutorial, let's learn how to install FTP server on Ubuntu. FTP or File Transfe ...

  8. 如何在Ubuntu上安装MariaDB

    We can install MariaDB on Ubuntu from the Ubuntu repositories or the official MariaDB repositories. ...

  9. ubuntu的web服务器_如何在Ubuntu上安装OpenLiteSpeed Web服务器?

    ubuntu的web服务器 Want to install OpenLiteSpeed Webserver on Ubuntu? Today we're going to do just that. ...

最新文章

  1. 资源 | 12月机器学习TOP 10文章,错过的快补课
  2. ubuntu安装 zookeeper3.3.6 由于jdk问题启动失败
  3. 如何基于Docker快速搭建Elasticsearch集群?
  4. dd var tmp .oracle,Oracle 11gR2 RAC ohasd failed to start 解决方法
  5. 【iCore3 双核心板_FPGA】例程二:GPIO输出实验——点亮三色LED
  6. 检测手机用户安装的应用程序是否有使用某权限
  7. 头文件不是可有可无的
  8. [导入]Nebula3学习笔记(6): IO实战, ZIP解压缩程序
  9. lzg_ad:在XP Professional上面实现EWF功能
  10. GBDT算法(最简单)
  11. OAI LTE系统搭建 -- OAI EPC
  12. 计算机地图制图的点状符号制作,计算机地图制图地图符号库系统建立..doc
  13. LeaRun.Java可视化流程简单配置过程
  14. Chrome谷歌浏览器启用flash插件
  15. Espresso测试框架
  16. el-select被嵌套太多层导致选不中
  17. ABB机器人编程示例
  18. springcloud引言
  19. 裴波那契数列(循环实现递归)
  20. JMS(Java Messaging Service)基础

热门文章

  1. 集成sleuth_Spring Cloud Sleuth整合zipkin过程解析
  2. ACM Uva10935 卡片游戏
  3. 计算机病毒的6大特征
  4. iOS 远程消息推送,原理和开发详解篇(新手推荐)
  5. mysql 续行符_Python 字符串
  6. python部落之python刷题宝之基础知识
  7. orcal—Mybatis—梳理
  8. 矢量控制仿真转速和转矩都一直为负的问题
  9. qt学生管理系统(一)
  10. react框架学习总结(纯干货)