【发布时间】:2016-12-02 01:37:26
【问题描述】:
我正在尝试构建和安装 fbtorch,但是当我使用 cmake 时出现以下错误:
CMake Error at CMakeLists.txt:9 (FIND_PACKAGE):
By not providing "FindTorch.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Torch", but
CMake did not find one.
Could not find a package configuration file provided by "Torch" with any of
the following names:
TorchConfig.cmake
torch-config.cmake
Add the installation prefix of "Torch" to CMAKE_PREFIX_PATH or set
"Torch_DIR" to a directory containing one of the above files. If "Torch"
provides a separate development package or SDK, be sure it has been
installed.
我在网上搜索,找到了一些解决方法,比如使用
source ~/torch/install/bin/torch-activate
或重新安装torch,但没有任何帮助。 有人可以帮我吗?谢谢。
【问题讨论】:
-
应该有文件
TorchConfig.cmake,是torch安装自带的。这个文件在你机器上的什么位置? -
@Tsyvarev 我发现了两个 TorchConfig.cmake。一个在 install/share/cmake/torch,另一个在 pkg/torch/build/cmake-exports
-
如错误消息所示,将变量 Torch_DIR 设置为包含该文件的目录。例如,调用 cmake 时:
cmake -DTorch_DIR=install/share/cmake/torch ...