我正在使用OpenCv
库编写python
程序。我的项目文件夹是Foo,里面有一个图像和可执行文件。我的CmakeLists.txt
如下所示:
cmake_minimum_required(VERSION 2.8)
project(Foo)
find_package( OpenCV REQUIRED )
add_executable(Foo Im.py)
target_link_libraries(Foo ${OpenCV_LIBS} ${python2.7} )
当我执行cmake .
时,出现以下错误:
-- Configuring done
CMake Error: CMake can not determine linker language for target: Foo
CMake Error: Cannot determine link language for target "Foo".
-- Generating done
-- Build files have been written to: /home/user_name/OpenCv/Foo
我正在使用python 2.7和linux 16.04。
> CMake 用于编译源代码(例如 C++ 或 C 代码(。
OpenCV库可以与C,C++或Python一起使用。 在这里,我猜你想在OpenCV库中使用Python,所以你不应该需要CMake,因为Python是一种解释型语言,而不是像C++那样的编译语言。
您可以使用以下命令执行脚本:
python3 path/to/your/script.py
或者,如果您使用该语言的先前版本(Python 2(:
python2 path/to/your/script.py