首先需要安装python3.7
整体流程是正确的,在安装过程中你可能需要解决一些问题,但这些问题都很好解决,搜一下就ok。当然,如果你足够幸运,你也许一个问题也不用解决。
根据这个文章安装:https://blog.csdn.net/u010681693/article/details/95044857
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa #sudo add-apt-repository ppa:jonathonf/python-3.7
sudo apt-get update
sudo apt-get install python3.7
cd /usr/bin
ls -l | grep python
sudo rm python
sudo ln -s python3.7 python
sudo vim /etc/apt/sources.list
在文件结尾添加如下内容,保存并退出:
deb http://cn.archive.ubuntu.com/ubuntu bionic main multiverse restricted universe
deb http://cn.archive.ubuntu.com/ubuntu bionic-updates main multiverse restricted universe
deb http://cn.archive.ubuntu.com/ubuntu bionic-security main multiverse restricted universe
deb http://cn.archive.ubuntu.com/ubuntu bionic-proposed main multiverse restricted universe
接着执行:
sudo apt-get update
会出现报错:
(appstreamcli:12392): GLib-CRITICAL **: g_strchug: assertion ‘string != NULL’ failed
(appstreamcli:12392): GLib-CRITICAL **: g_strchomp: assertion ‘string != NULL’ failed
(appstreamcli:12392): GLib-CRITICAL **: g_strchug: assertion ‘string != NULL’ failed
(appstreamcli:12392): GLib-CRITICAL **: g_strchomp: assertion ‘string != NULL’ failed
(appstreamcli:12392): GLib-CRITICAL **: g_strchug: assertion ‘string != NULL’ failed
(appstreamcli:12392): GLib-CRITICAL **: g_strchomp: assertion ‘string != NULL’ failed
AppStream cache update completed, but some metadata was ignored due to errors.
解决办法为执行如下指令:
sudo apt-get install libappstream4
接着执行如下命令:
sudo apt-get install python3-pip
会出现报错:
The following information may help to resolve the situation:
The following packages have unmet dependencies:
debconf : Breaks: update-notifier-common (< 3.187~) but 3.168.3 is to be installed
gnupg : Breaks: software-properties-common (<= 0.96.24.3) but 0.96.20.10 is to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
使用如下命令解决:
sudo apt-get install aptitude
sudo aptitude install python3-pip
sudo apt install python3-pip
接着会出现报错:
E: Sub-process /usr/bin/dpkg returned an error code (1)
使用如下命令解决:
sudo mv /var/lib/dpkg/info /var/lib/dpkg/info.bk
sudo mkdir /var/lib/dpkg/info
sudo apt-get update
sudo apt-get install -f
sudo mv /var/lib/dpkg/info/* /var/lib/dpkg/info.bk
sudo rm -rf /var/lib/dpkg/info
sudo mv /var/lib/dpkg/info.bk /var/lib/dpkg/info
接着继续安装python相关:
sudo apt-get install python3-distutils
sudo vim /usr/local/bin/pip
修改文件如下:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from pip import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())
接着执行:
pip --version
python -m pip install --upgrade pip
sudo vim /usr/local/bin/pip
修改文件如下:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from pip import __main__
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(__main__._main())
然后安装pwn-tools
pip3 install pwn
然后你可能遇到这个比较难解决的问题:
error: can't find Rust compiler
*省略*
ERROR: Failed building wheel for cryptography
执行如下命令解决:
export CRYPTOGRAPHY_DONT_BUILD_RUST=1
pip3 install cryptography==3.1.1