Ubuntu下升级Cmake版本

问题

CMake 3.8.2 or higher is required.  You are running version 3.5.1

方案1 卸载重装

1.卸载之前系统中cmake

sudo apt remove --purge cmake
hash -r

2.安装build-essential

sudo apt-get install build-essential 

3.获取cmake

wget http://www.cmake.org/files/v3.8/cmake-3.8.2.tar.gz

4.解压与安装

tar xf cmake-3.8.2.tar.gz
cd cmake-3.8.2
./configure
make
sudo make install

5.查看版本

cmake --version

6.成功安装cmake后,如果出现-bash: /usr/bin/cmake: No such file or directory,则可以手动添加,找到安装的cmake文件,进入cmake3.x文件夹中,在进入bin文件夹,运行:

cp ./cmake-3.x/bin/cmake /usr/bin/

方案2 通过软链接

# 下载
wget https://cmake.org/files/v3.x/cmake-3.x-Linux-x86_64.tar.gz
tar -xzvf cmake-3.x-Linux-x86_64.tar.gz

# 解压出来的包,将其放在 /opt 目录下,其他目录也可以
sudo mv cmake-3.x-Linux-x86_64 /opt/cmake-3.x

# 建立软链接
sudo ln -sf /opt/cmake-3.x/bin/*  /usr/bin/

# 查看 cmake 版本
cmake --version
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值