linux - ubuntu16.04安装python的requests模块失败,怎么解决?

查看:562
本文介绍了linux - ubuntu16.04安装python的requests模块失败,怎么解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

最近在尝试用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!!

解决方案

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

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

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

这篇关于linux - ubuntu16.04安装python的requests模块失败,怎么解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆