Python cmake 错误“源似乎不包含 CMakeLists.txt”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/46448682/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
cmake error 'the source does not appear to contain CMakeLists.txt'
提问by KVS
I'm installing opencv in ubuntu 16.04. After installing the necessary prerequisites I used the following command:-
我正在 ubuntu 16.04 中安装 opencv。安装必要的先决条件后,我使用了以下命令:-
kvs@Hunter:~/opencv_contrib$ mkdir build
kvs@Hunter:~/opencv_contrib$ cd build
kvs@Hunter:~/opencv_contrib/build$
kvs@Hunter:~/opencv_contrib/build$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX+/usr/local -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules -D BUILD_EXAMPLES=ON ..
but it produced an error:-
但它产生了一个错误:-
CMake Error: The source directory "/home/kvs/opencv_contrib" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
I used the command provided in the folder 'module' documentation. How do I solve it? I tried the answers here at stack-overflowand a few other question but still can't figure it out.
我使用了文件夹“模块”文档中提供的命令。我该如何解决?我在stack-overflow和其他一些问题中尝试了这里的答案,但仍然无法弄清楚。
Project Git repository here.
项目 Git 存储库在这里。
回答by Quang Hoang
You should do mkdir build
and cd build
while inside opencv
folder, not the opencv-contrib
folder. The CMakeLists.txt
is there.
您应该在文件夹内而不是文件夹内执行mkdir build
和操作。在那里。cd build
opencv
opencv-contrib
CMakeLists.txt
回答by K. Symbol
Since you add ..
after cmake, it will jump up and up (just like cd ..
) in the directory. But if you want to run cmake under the same folder with CMakeLists.txt, please use .
instead of ..
.
由于您..
在 cmake 之后添加,它会cd ..
在目录中向上跳跃(就像)。但是如果你想用的CMakeLists.txt同一文件夹下运行cmake,请用.
代替..
。
回答by puru
This reply may be late but it may help users having similar problem. The opencv-contrib (available at https://github.com/opencv/opencv_contrib/releases) contains extra modules but the build procedure has to be done from core opencv (available at from https://github.com/opencv/opencv/releases) modules.
此回复可能较晚,但可以帮助遇到类似问题的用户。opencv-contrib(可从https://github.com/opencv/opencv_contrib/releases 获得)包含额外的模块,但构建过程必须从核心 opencv 完成(可从https://github.com/opencv/opencv 获得) /releases) 模块。
Follow below steps (assuming you are building it using CMake GUI)
按照以下步骤操作(假设您使用 CMake GUI 构建它)
Download openCV (from https://github.com/opencv/opencv/releases) and unzip it somewhere on your computer. Create build folder inside it
Download exra modules from OpenCV. (from https://github.com/opencv/opencv_contrib/releases). Ensure you download the same version.
Unzip the folder.
Open CMake
Click Browse Source and navigate to your openCV folder.
Click Browse Build and navigate to your build Folder.
Click the configure button. You will be asked how you would like to generate the files. Choose Unix-Makefile from the drop down menu and Click OK. CMake will perform some tests and return a set of red boxes appear in the CMake Window.
Search for "OPENCV_EXTRA_MODULES_PATH" and provide the path to modules folder (e.g. /Users/purushottam_d/Programs/OpenCV3_4_5_contrib/modules)
Click Configure again, then Click Generate.
Go to build folder
下载 openCV(从https://github.com/opencv/opencv/releases)并将其解压缩到您计算机上的某个位置。在其中创建构建文件夹
从 OpenCV 下载 exra 模块。(来自https://github.com/opencv/opencv_contrib/releases)。确保您下载相同的版本。
解压文件夹。
打开 CMake
单击浏览源并导航到您的 openCV 文件夹。
单击浏览构建并导航到您的构建文件夹。
单击配置按钮。系统会询问您希望如何生成文件。从下拉菜单中选择 Unix-Makefile,然后单击 OK。CMake 将执行一些测试并返回一组出现在 CMake 窗口中的红色框。
搜索“OPENCV_EXTRA_MODULES_PATH”并提供模块文件夹的路径(例如/Users/purushottam_d/Programs/OpenCV3_4_5_contrib/modules)
再次单击配置,然后单击生成。
转到构建文件夹
# cd build
# make
# sudo make install
- This will install the opencv libraries on your computer.
- 这将在您的计算机上安装 opencv 库。