今天pip装一个python包死活装不上,报的错也奇奇怪怪:
CMake Error at CMakeLists.txt:8 (cmake_minimum_required):
CMake 3.18...3.27 or higher is required. You are running version 3.10.2
从来没见过的错误,sudo apt install cmake
cmake is already the newest version (3.10.2-1ubuntu2.18.04.2).
于是升级一下GPU docker的cmake
- 下载
wget https://cmake.org/files/v3.22/cmake-3.22.1.tar.gz
- 解压:
tar -xvzf cmake-3.22.1.tar.gz
- 进入解压目录,配置成功之后显示:CMake has bootstrapped. Now run make.
chmod 777 ./configure
./configure
- 配置完成后,编译:
make
- 编译完成后,安装:
sudo make install
- 最后使用新安装的cmake替换旧版本,其中/usr/local/bin/cmake为新安装的cmake目录。
# 新cmake
/usr/local/bin/cmake --version
# 老cmake
/usr/bin/cmake --version
# 替换
sudo update-alternatives --install /usr/bin/cmake cmake /usr/local/bin/cmake 1 --force
- 最后测试cmake版本:
cmake --version
# cmake version 3.22.1
# CMake suite maintained and supported by Kitware (kitware.com/cmake).