use*_*308 4 installation ubuntu cmake
我已经下载了该cmake-3.11.3-Linux-x86_64.sh文件。然后我执行它并创建了一个文件夹,其中有一个bin文件cmake。我尝试/etc/environment像这样编辑:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/m/FILES/CMake/cmake-3.11.3-Linux-x86_64/bin"
Run Code Online (Sandbox Code Playgroud)
但是当我尝试这个命令时:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
Run Code Online (Sandbox Code Playgroud)
我收到这条消息:
当前未安装程序“cmake”。您可以通过键入以下命令来安装它: sudo apt install cmake
我所做的哪一部分是错误的,我该如何解决?
我假设您从CMake 的下载页面下载了该脚本。诚然,如何使用它的文档有点稀疏。
简而言之,调用(这里CMake的安装路径是/usr/local):
# sudo cmake-3.11.3-Linux-x86_64.sh --skip-license --exclude-subdir --prefix=/usr/local
Run Code Online (Sandbox Code Playgroud)
注意:您需要先卸载任何包管理器安装的 CMake 包
# sudo apt remove cmake
# sudo apt purge --auto-remove cmake
Run Code Online (Sandbox Code Playgroud)
选项
该脚本有以下选项:
# cmake-3.11.3-Linux-x86_64.sh --help
Usage: cmake-3.11.3-Linux-x86_64.sh [options]
Options: [defaults in brackets after descriptions]
--help print this message
--version print cmake installer version
--prefix=dir directory in which to install
--include-subdir include the cmake-3.11.3-Linux-x86_64 subdirectory
--exclude-subdir exclude the cmake-3.11.3-Linux-x86_64 subdirectory
--skip-license accept license
Run Code Online (Sandbox Code Playgroud)
您正在寻找的那个是--prefix=dir. 否则,它将仅使用当前目录来提取安装文件。
在 Ubuntu 上测试输出
# cmake-3.11.3-Linux-x86_64.sh --skip-license --exclude-subdir --prefix=/usr/local
CMake Installer Version: 3.11.3, Copyright (c) Kitware
This is a self-extracting archive.
The archive will be extracted to: /usr/local
Using target directory: /usr/local
Extracting, please wait...
Unpacking finished successfully
# cmake --version
cmake version 3.11.3
CMake suite maintained and supported by Kitware (kitware.com/cmake).
Run Code Online (Sandbox Code Playgroud)
参考/替代方案
| 归档时间: |
|
| 查看次数: |
11650 次 |
| 最近记录: |