pwntools安装及遇到问题解决

本安装基于Ubuntu32位系统,系统已经按照python2.7 以及pip。
使用最简单的安装方法:

sudo pip install pwntools

但安装出现错误:

You must install the Python development headers!
$ apt-get install python-dev

转而去安装缺少的包:

apt-get install python-dev

又出现如下错误:

The following packages have unmet dependencies:
 python2.7-dev : Depends: python2.7 (= 2.7.6-8) but 2.7.6-8ubuntu0.2 is to be installed
                 Depends: libpython2.7-dev (= 2.7.6-8) but it is not going to be installed
                 Depends: libpython2.7 (= 2.7.6-8) but 2.7.6-8ubuntu0.2 is to be installed
                 Depends: libexpat1-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

解决方案:通过aptitude工具
1、首先安装aptitude:

sudo apt-get install aptitude

2、通过aptitude安装python-dev:

sudo aptitude install python-dev

出现:

The following actions will resolve these dependencies:
     Keep the following packages at their current version:
1)     libexpat1-dev [Not Installed]                      
2)     libpython-dev [Not Installed]                      
3)     libpython2.7-dev [Not Installed]                   
4)     python-dev [Not Installed]                         
5)     python2.7-dev [Not Installed]                      
Accept this solution? [Y/n/q/?] n

这里一定选n,然后:

The following actions will resolve these dependencies:
     Downgrade the following packages:                                  
1)     libexpat1 [2.1.0-4ubuntu1.3 (now) -> 2.1.0-4ubuntu1 (trusty)]    
2)     libpython2.7 [2.7.6-8ubuntu0.2 (now) -> 2.7.6-8 (trusty)]        
3)     libpython2.7-minimal [2.7.6-8ubuntu0.2 (now) -> 2.7.6-8 (trusty)]
4)     libpython2.7-stdlib [2.7.6-8ubuntu0.2 (now) -> 2.7.6-8 (trusty)] 
5)     python2.7 [2.7.6-8ubuntu0.2 (now) -> 2.7.6-8 (trusty)]           
6)     python2.7-minimal [2.7.6-8ubuntu0.2 (now) -> 2.7.6-8 (trusty)]   
Accept this solution? [Y/n/q/?] y

这里一定选y,然后再遇到都选择y即可按照完毕!
然后执行下面的pip按照就ok了!然后再安装pwntools:

sudo pip install pwntools

如果再出现错误:

Cannot uninstall 'pyserial'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

在安装命令中添加–ignore-installed:

sudo pip install --ignore-installed pwntools

如果出现类似如下错误:

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-f8m_zq/statsmod

原因是安装工具包时需要抓取网页因而要处理 https,而处理 https 又依赖加解密算法(即 cryptography 包),而 cryptography 又依赖傅立叶变换的算法以及相应的编译环境。Ubuntu 默认没有安装 libffi-dev 和 libssl-dev,gcc 也不一定安装,而 目标安装包又没有将相关软件包记到依赖列表里,因此需要先手动安装:

sudo apt-get install libssl-dev libffi-dev python-dev build-essential libxml2-dev libxslt1-dev
  • 4
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值