如何在 Ubuntu 22.04 LTS 上安装 Python Pip

2023年 7月 20日 58.8k 0

Pip 是标准的包管理系统,用于安装和管理用 Python 编写的包的软件。使用 PIP,您可以从 Python 包索引 (PyPI) 列出、搜索和下载以安装包。python-logo

在 Ubuntu 22.04 LTS Jammy Jellyfish 上安装 Python Pip

apt步骤 1. 首先,通过在终端中运行以下命令,确保所有系统包都是最新的。

sudo apt update
sudo apt upgrade
sudo apt install gnupg ca-certificates apt-transport-https software-properties-common

步骤 2. 在 Ubuntu 22.04 上安装 Python Pip。

默认情况下,Python 在 Ubuntu 22.04 基础存储库中可用。现在运行以下命令将最新版本的 Python Pip 安装到您的 Ubuntu 系统:

sudo apt install python3-pip

完成安装过程后,运行以下命令通过检查 pip 版本来验证安装:

pip3 --version

步骤 3. Pip 命令示例。

要查看所有 pip 命令和选项的列表,请键入以下命令:

[root@idroot.us ~]# pip --help

Usage:   
  pip  [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.
  bundle                      DEPRECATED. Create pybundles.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  -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-file            Path to a verbose non-appending log, that only logs failures. This
                              log is active by default at /home/sharad/.pip/pip.log.
  --log                 Path to a verbose appending log. This log is inactive by default.
  --proxy              Specify a proxy in the form [user:passwd@]proxy.server:port.
  --timeout              Set the socket timeout (default 15 seconds).
  --exists-action     Default action when a path already exists: (s)witch, (i)gnore,
                              (w)ipe, (b)ackup.
  --cert                Path to alternate CA bundle.

要安装新的 python 包类型:

pip3 install 

例如,要通过 Pip 安装 numpy,您将运行以下命令:

python3 -m pip install numpy

要卸载 pip 类型安装的 python 包:

pip3 uninstall 

要搜索 python 包类型:

pip3 search 

感谢您使用本教程在 Ubuntu 22.04 LTS Jammy Jellyfish 系统上安装 Python Pip。如需更多帮助或有用信息,我们建议您查看Python 官方网站。

相关文章

服务器端口转发,带你了解服务器端口转发
服务器开放端口,服务器开放端口的步骤
产品推荐:7月受欢迎AI容器镜像来了,有Qwen系列大模型镜像
如何使用 WinGet 下载 Microsoft Store 应用
百度搜索:蓝易云 – 熟悉ubuntu apt-get命令详解
百度搜索:蓝易云 – 域名解析成功但ping不通解决方案

发布评论