安装python 2.7.18
(注)使用apt install python安装的版本是2.7.10,该版本对部分项目存在兼容性问题,因此需要手动编译安装
安装python编译环境
sudo apt install python-dev pkg-config libreadline-dev libc6-dev libncursesw5-dev build-essential gdb pkg-config libbz2-dev libffi-dev libgdbm-dev liblzma-dev libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev lzma lzma-dev tk-dev uuid-dev zlib1g-dev libmpdec-dev
手动编译
wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz
tar xf Python-2.7.18.tgz
cd Python-2.7.18
./configure --enable-optimizations
make -j32
编译之后如果提示缺少以下组件,可以不用关心,这些都是丢弃或者不适用的组件
sudo make install
安装pip,不要使用root
schroot
wget https://bootstrap.pypa.io/pip/get-pip.py
chmod +x get-pip.py
python2 get-pip.py