在Ubuntu上安装Pip失败

3

我在Ubuntu 16.04 LTS的终端中输入了以下命令-

 $ sudo apt install python-pip

它报错如下:

> Reading package lists... Done Building dependency tree        Reading
> state information... Done You might want to run 'apt-get -f install'
> to correct these: The following packages have unmet dependencies: 
> bcmwl-kernel-source:i386 : Depends: dkms:i386
>                             Depends: linux-libc-dev:i386 but it is not going to be installed
>                             Depends: libc6-dev:i386 but it is not going to be installed
>                             Depends: linux-headers-generic:i386 but it is not going to be installed or
>                                      linux-headers:i386  dkms : Depends: module-init-tools but it is not going to be installed 
> python-pip : Depends: python-pip-whl (= 8.1.1-2ubuntu0.4) but it is
> not going to be installed
>               Recommends: python-all-dev (>= 2.6) but it is not going to be installed
>               Recommends: python-setuptools but it is not going to be installed
>               Recommends: python-wheel but it is not going to be installed E: Unmet dependencies. Try 'apt-get -f install' with no
> packages (or specify a solution).

如何安装pip?请查看上面的错误。

1
首先运行 sudo apt-get -f install - Arvind
你应该看到上面的错误信息,它会告诉你该怎么做 :) 你可能需要运行 'apt-get -f install' - Jan Sila
Stack Overflow是一个关于编程和开发问题的网站。这个问题似乎不属于编程或开发范畴。请参阅帮助中心中的我可以在这里问什么样的问题。也许超级用户Unix&Linux Stack Exchange更适合提问。另请参阅我应该在哪里发布Dev Ops相关问题? - jww
3个回答

3
好的,要安装pip,您需要安装那些缺失的依赖。请尝试以下步骤:
1. 更新软件包列表:在终端中输入命令sudo apt-get update 2. 然后升级现有软件包:在终端中输入命令sudo apt-get upgrade 3. 最后安装pip:在终端中输入命令sudo apt-get install python-pip 如果不成功,请尝试添加-f参数。
如需更多帮助,请参见https://www.liquidweb.com/kb/how-to-install-pip-on-ubuntu-14-04-lts/

dkms:依赖于module-init-tools,但它不会被安装。这是意味着我需要安装dkms吗? - Reshu Singh
pip已安装。谢谢:D - Reshu Singh
@ReshuSingh 很好!将此作为正确答案!很高兴能帮到你! - MichaelMMeskhi

3

在搜索了很多之后,最终这个方法对我有用。

sudo apt-get install aptitude

然后使用以下命令安装pip3:

sudo aptitude install python3-pip

1

运行

sudo apt -f install

如果命令仍然无法运行,请尝试重新运行命令。如果仍然不起作用,我认为您需要安装/升级一些出错的软件包。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接