使用Linux包管理器安装pip/setuptools/wheel

页面状态

不完整

上次审阅时间

2015-09-17

本节介绍如何安装 pipsetuptoolswheel 使用Linux包管理器。

如果您使用的是从 python.org ,则本节不适用。查看 安装包的要求 改为节。

请注意,对于 pipsetuptoolswheel 由特定的Linux发行版支持,在发布给公众时会过时,并且更新通常只出于安全原因,而不是功能更新。对于某些发行版,可以启用其他存储库来提供较新的版本。我们知道的存储库在下面解释。

还要注意的是,为了安全和规范化,分发版应用补丁到自己的标准中有些常见。在某些情况下,这可能导致错误或与原始未修补版本不同的意外行为。当我们知道这一点时,我们将在下面注明。

费多拉

  • 费多拉21:

    • Python 2:

      sudo yum upgrade python-setuptools
      sudo yum install python-pip python-wheel
      
    • Python 3: sudo yum install python3 python3-wheel

  • 费多拉22:

    • Python 2:

      sudo dnf upgrade python-setuptools
      sudo dnf install python-pip python-wheel
      
    • Python 3: sudo dnf install python3 python3-wheel

要获取更新版本的pip、setuptools和wheel for python 2,可以启用 PyPA Copr Repo using the Copr Repo instructions ,然后运行:

sudo yum|dnf upgrade python-setuptools
sudo yum|dnf install python-pip python-wheel

Centos/瑞尔

Centos和Rhel不提供 pipwheel 但在他们的核心存储库中 setuptools 默认情况下安装。

要为系统python安装pip和wheel,有两个选项:

  1. 启用 EPEL repository using these instructions . 在EPEL6和EPEL7上,可以这样安装PIP:

    sudo yum install python-pip
    

    在EPEL 7(而不是EPEL 6)上,可以这样安装车轮:

    sudo yum install python-wheel
    

    由于EPEL只提供额外的、无冲突的包,所以EPEL不提供安装工具,因为它位于核心存储库中。

  2. 启用 PyPA Copr Repo using these instructions 1. 您可以这样安装PIP和车轮:

    sudo yum install python-pip python-wheel
    

    要另外升级安装工具,请运行:

    sudo yum upgrade python-setuptools
    

要在并行非系统环境(使用yum)中安装pip、wheel和setuptools,有两个选项:

  1. 使用“软件集合”功能启用包含PIP、设置工具和控制盘的并行集合。

    请注意,集合可能不包含最新版本。

  2. 启用 IUS repository 安装一个 parallel-installable Python ,还有PIP、安装工具和轮子,都是最新的。

    例如,对于centos7/rhel7上的python 3.4:

    sudo yum install python34u python34u-wheel
    

欧彭斯

  • Python 2:

    sudo zypper install python-pip python-setuptools python-wheel
    
  • Python 3:

    sudo zypper install python3-pip python3-setuptools python3-wheel
    

Debian/Ubuntu

  • Python 2:

    sudo apt install python-pip
    
  • Python 3:

    sudo apt install python3-venv python3-pip
    

警告

最近的debian/ubuntu版本修改了pip以使用 "User Scheme" 默认情况下,这是一个重要的行为变化,可能会让一些用户感到惊讶。

Arch Linux系统

  • Python 2:

    sudo pacman -S python2-pip
    
  • Python 3:

    sudo pacman -S python-pip
    

1

目前,没有“copr”yum插件可用于CentOS/Rhel,因此唯一的选择是手动放置repo文件,如前所述。