素材牛VIP会员
ubuntu16.04安装python的requests模块失败,怎么解决?
 sk***e4  分类:Python  人气:1117  回帖:6  发布于6年前 收藏

最近在尝试用python写爬虫,需要用到requests模块,却安装不上。
系统ubuntu16.04, 使用系统默认的python2.7. 运行python代码时,报错:
p@G :~/Desktop$ sudo apt-get install python-requests
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.
bcloud : Depends: python3-crypto but it is not going to be installed

      Depends: python3-pyinotify but it is not going to be installed
      Depends: python3-keyring but it is not going to be installed

python-requests : Depends: python-urllib3 (>= 1.13.1) but it is not going to be installed

               Depends: python-chardet but it is not going to be installed
               Depends: python-urllib3 (< 1.13.2) but it is not going to be installed

E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

尝试更新软件源,未解决。
尝试安装python3-crypto等模块,未解决。
百度说,可能是PPA版本问题,但未安装和删除过PPA.
这是什么问题?
Any help will be welcomed!!

相关内容推荐:

讨论这个帖子(6)垃圾回帖将一律封号处理……

Lv5 码农
阴***光 学生 6年前#1

apt-get install -f

没好我回去补充吧,我上周也是踩了这些坑,折腾了几个小时,看的stackoverflow上面答案解决的。

Lv5 码农
躺***上 技术总监 6年前#2

askubuntu.com/questions/140246/how-do-i-resolve-unmet-dependencies-after-adding-a-ppa
这可能是apt依赖管理出现了问题,你可以根据这个链接里详细教程尝试修复这个问题,也可以使用

aptitude install <package name>

来强行装上依赖包,来完成安装

Lv6 码匠
bo***18 产品经理 6年前#3

谢谢各位。确实是以来关系的问题。用apt-get install -f修复即可。
昨天我把报错理解错了,以为是安装时需要加上-f选项。使用apt-get install -f python-requests命令未成功。

Lv3 码奴
阿***盗 页面重构设计 6年前#4

Ubuntu是基于 Debian 的发行版,请用好apt-get(从14.04起,新的更新中就可以直接使用 apt 了),还有,注意看提示,让你先修复依赖关系。

  1. 请先执行apt-get -f install 修正(依赖关系)破损的软件包

  2. python的requests包是有PPA源的,直接使用apt安装即可 apt-get install python-requests

Lv1 新人
冷***知 职业无 6年前#5

人生苦短, 快用ANACONDA

conda install xxx 打爆一切

Lv5 码农
ah***xr 软件测试工程师 6年前#6

你可以使用pip安装哦

 文明上网,理性发言!   😉 阿里云幸运券,戳我领取