2016-08-11 291 views
0

我想安装DLIB模块,我已经安装了CMake的升压蟒蛇但蟒蛇当我安装DLIB它给我的错误:如何将BOOST_ROOT和BOOST_LIBRARY传递给CMake?

We couldn't find the right version of boost python. If you installed boost and you are still getting this error then you might have installed a version of boost that was compiled with a different version of visual studio than the one you are using. So you have to make sure that the version of visual studio is the same version that was used to compile the copy of boost you are using. -- Set the BOOST_ROOT and BOOST_LIBRARYDIR environment variables before running cmake.

例如事情是这样的:

set BOOST_ROOT=C:\local\boost_1_57_0 

set BOOST_LIBRARYDIR=C:\local\boost_1_57_0\stage\lib 

我无法弄清楚如何设置BOOST_ROOTBOOST_LIBRARYDIR路径。

回答

1

临时设置环境变量运行的CMake之前,你可以在控制台输入这些命令:

set BOOST_ROOT=C:\local\boost_1_57_0 
set BOOST_LIBRARYDIR=C:\local\boost_1_57_0\stage\lib 
cmake ... 

要永久设置它们,你可以使用setx或通过单击Windows图形用户界面。

我建议对这些做法,更干净和可靠的方式将通过这些变量直接CMake的:

cmake -DBOOST_ROOT=C:\local\boost_1_57_0 -DBOOST_LIBRARYDIR=C:\local\boost_1_57_0\stage\lib 
+0

当我在命令行中运行“pip install dlib”时,根据您的解决方案设置变量后,会给我带来相同的错误i-e“设置BOOST_ROOT和BOOST_LIBRARYDIR”,但是升级已成功安装。 –

0

cmake电话与-D后只需添加他们。你的情况,这将是

cmake -DBOOST_ROOT=C:\local\boost_1_57_0 -DBOOST_LIBRARYDIR=C:\local\boost_1_57_0\stage\lib .. 

你应该给定的命令之前清除CMake的缓存(删除构建目录或只是CMakeCache.txt文件)。

+0

根据你的解决方案,它成功地建立了文件,但之后,当我安装dlib模块使用这个命令“pip install dlib”给了我同样的错误当我运行这个命令时没有找到提升。 –

+0

这与这个问题无关。 – usr1234567