opencv安装中的python错误

时间:2013-03-28 02:48:10

标签: python opencv build cmake

我正在尝试在Linux中安装opencv库,我在python脚本生成的日志中收到以下错误:

Traceback (most recent call last):
  File "/tmcleod/opencv-2.4.4/modules/java/generator/gen_javadoc.py", line 257, in ?
    import hdr_parser
  File "/tmcleod/opencv-2.4.4/modules/java/generator/../../python/src2/hdr_parser.py", line 641
    decl[1] = ": " + ", ".join([b if "::" in b else self.get_dotted_name(b).replace(".","::") for b in bases])
                                   ^
SyntaxError: invalid syntax

以下是makefile中导致错误的命令:

cd /tmcleod/opencv-2.4.4/release/modules/java && /usr/bin/python2 /tmcleod/opencv-2.4.4/modules/java/generator/gen_javadoc.py --modules core,imgproc,objdetect,features2d,video,highgui,ml,calib3d,photo,contrib /tmcleod/opencv-2.4.4/modules/java/generator/src/java /tmcleod/opencv-2.4.4/release/modules/java 2>"/tmcleod/opencv-2.4.4/release/modules/java/get_javadoc_errors.log"

我不知道为什么我需要在安装C ++库时生成java文档,但问题是导致构建失败。任何帮助表示赞赏。

1 个答案:

答案 0 :(得分:3)

这里的问题是cmake发现python可执行文件的旧版本(2.4)不理解这个构造。解决方法是将cmake路径传递给python。从 opencv extract目录:

$ mkdir release
$ cd release
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=./build -D PYTHON_EXECUTABLE=/tmcleod/Python-2.7.3/python ..
$ make
$ make install