Dav*_*.it 8 centos cmake python-2.7 centos7 pytorch
我试图在我的Linux CentOS 7.3上安装PyTorch.我下载了它的包,运行此命令并得到此错误:
sudo python setup.py install
running install
running build_deps
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
CMake 3.0 or higher is required. You are running version 2.8.12.2
-- Configuring incomplete, errors occurred!
Run Code Online (Sandbox Code Playgroud)
所以我尝试使用该命令安装CMake 3
sudo yum -y install cmake3
Run Code Online (Sandbox Code Playgroud)
安装顺利,但系统仍然使用cmake2.8作为默认设置.如果我输入yum info comnmand,我会得到:
sudo yum info cmake
Installed Packages
Name : cmake
Arch : x86_64
Version : 2.8.12.2
Release : 2.el7
Size : 27 M
Repo : installed
From repo : base
Summary : Cross-platform make system
URL : http://www.cmake.org
License : BSD and MIT and zlib
Description : CMake is used to control the software compilation process using simple
: platform and compiler independent configuration files. CMake generates
: native makefiles and workspaces that can be used in the compiler
: environment of your choice. CMake is quite sophisticated: it is possible
: to support complex environments requiring system configuration, preprocessor
: generation, code generation, and template instantiation.
Run Code Online (Sandbox Code Playgroud)
所以,问题很明显:系统仍然将cmake2.8视为默认值,因此Python不会将cmake3用于其PyTorch安装. 我怎么解决这个问题?
谢谢
sak*_*kra 28
一旦在计算机上安装cmake了cmake3软件包和软件包,就可以使用update-alternatives在两个软件包之间切换.
使用该alternatives命令注册两个安装:
$ sudo alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake 10 \
--slave /usr/local/bin/ctest ctest /usr/bin/ctest \
--slave /usr/local/bin/cpack cpack /usr/bin/cpack \
--slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake \
--family cmake
$ sudo alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake3 20 \
--slave /usr/local/bin/ctest ctest /usr/bin/ctest3 \
--slave /usr/local/bin/cpack cpack /usr/bin/cpack3 \
--slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake3 \
--family cmake
Run Code Online (Sandbox Code Playgroud)
cmake3当您cmake从bash提示符输入或启动bash脚本时,默认情况下将调用这两个命令.这些命令还负责注册一些ctest需要与之一起切换的附加从命令cmake.
如果需要切换回cmake 2.8作为默认值,请运行以下命令:
$ sudo alternatives --config cmake
There are 2 programs which provide 'cmake'.
Selection Command
-----------------------------------------------
1 cmake (/usr/bin/cmake)
*+ 2 cmake (/usr/bin/cmake3)
Enter to keep the current selection[+], or type selection number: 1
Run Code Online (Sandbox Code Playgroud)
如果您没有 root 访问权限,只需创建一个像这样的链接(因为 ~/bin 通常位于您的 PATH 中):
ln -s /usr/bin/cmake3 ~/bin/cmake
Run Code Online (Sandbox Code Playgroud)
在 Centos 7 上安装 cmake3 后创建此符号链接对我有用:
sudo ln -s /usr/bin/cmake3 /usr/bin/cmake
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16598 次 |
| 最近记录: |