Ubuntu安装CodeChecker
首先环境使用的是Ubuntu16.04发行版
其自带的python版本为3.5,gcc版本为5
CodeChecker需要python版本>=3.6
经过实验,发现Ubuntu版本过低时,如果不能按照如下方法使用apt直接安装python,那么需要使用gcc对python源码进行进行编译安装。此时gcc版本应至少>=5。否则无法对python进行编译安装(至少gcc4.8.1不行)
因此如果需要gcc降级,那么务必在安装CodeChecker安装结束后再进行
1. 首先更新python版本(python3.5-python3.8)
安装依赖
$ sudo apt update
$ sudo apt install software-properties-common
添加PPA源
$ sudo add-apt-repository ppa:deadsnakes/ppa
单机回车后,可以使用apt安装python 3.8(找不到就apt update)
$ sudo apt update
$ sudo apt install python3.8
$ python3.8 -V
$ sudo apt install python3.8-distutils #pip需要的依赖
配置python默认版本为python3.8
$which python3.8
/usr/bin/python3.8
$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
$ which python3.5
/usr/bin/python3.5
$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 2
配置python3的默认指向
$ sudo update-alternatives --config python3
There are 2 choices for the alternative