在 CentOS 5 上构建 OpenCV 2.0 时遇到问题?

发布于 2024-09-01 09:52:55 字数 1225 浏览 12 评论 0原文

我一直在尝试将 OpenCV 库安装到我的 centos 系统中,但是当我在使用 cmake 配置后输入 make 并按 Enter 时,我收到以下错误:

[100%] Building CXX object tests/cv/CMakeFiles/cvtest.dir/src/amoments.o
[100%] Building CXX object tests/cv/CMakeFiles/cvtest.dir/src/affine3d_estimator.o
[100%] Building CXX object tests/cv/CMakeFiles/cvtest.dir/src/acontours.o
[100%] Building CXX object tests/cv/CMakeFiles/cvtest.dir/src/areprojectImageTo3D.o
Linking CXX executable ../../bin/cvtest
CMakeFiles/cvtest.dir/src/highguitest.o: In function `CV_HighGuiTest::run(int)':
highguitest.cpp:(.text._ZN14CV_HighGuiTest3runEi+0x15): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
[100%] Built target cvtest
make: *** [all] Error 2

有趣的是,一旦我收到此错误:

[ 99%] Built target mltest
[ 99%] Generating generated0.i
Traceback (most recent call last):
  File "/home/proje/OpenCV-2.1.0/interfaces/python/gen.py", line 43, in ?
    if True in has_init and not all(has_init[has_init.index(True):]):
NameError: name 'all' is not defined
make[2]: *** [interfaces/python/generated0.i] Error 1
make[1]: *** [interfaces/python/CMakeFiles/cvpy.dir/all] Error 2
make: *** [all] Error 2

这些错误的原因可能是什么?我需要立即在这台计算机上安装opencv。

I'd been trying to install OpenCV library to my centos system however when i type make and hit enter after configuring with cmake, i get the following error:

[100%] Building CXX object tests/cv/CMakeFiles/cvtest.dir/src/amoments.o
[100%] Building CXX object tests/cv/CMakeFiles/cvtest.dir/src/affine3d_estimator.o
[100%] Building CXX object tests/cv/CMakeFiles/cvtest.dir/src/acontours.o
[100%] Building CXX object tests/cv/CMakeFiles/cvtest.dir/src/areprojectImageTo3D.o
Linking CXX executable ../../bin/cvtest
CMakeFiles/cvtest.dir/src/highguitest.o: In function `CV_HighGuiTest::run(int)':
highguitest.cpp:(.text._ZN14CV_HighGuiTest3runEi+0x15): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
[100%] Built target cvtest
make: *** [all] Error 2

and interesting, once i got this error:

[ 99%] Built target mltest
[ 99%] Generating generated0.i
Traceback (most recent call last):
  File "/home/proje/OpenCV-2.1.0/interfaces/python/gen.py", line 43, in ?
    if True in has_init and not all(has_init[has_init.index(True):]):
NameError: name 'all' is not defined
make[2]: *** [interfaces/python/generated0.i] Error 1
make[1]: *** [interfaces/python/CMakeFiles/cvpy.dir/all] Error 2
make: *** [all] Error 2

What possibly is the cause of these errors? I need to install opencv immediately on this computer.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

烈酒灼喉 2024-09-08 09:52:55

我遇到了这个问题..这是Python接口...
默认情况下,CentOS 上安装的是 Python 2.4,并且升级到 2.6 以上并不容易。

当 OpenCV 构建时,它会被 Python 版本混淆......

所以我在“cmake”上禁用了 Python 接口,一切正常。

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_NEW_PYTHON_SUPPORT=NO ..

但是,当然你不能再将 OpenCV 与 Python 一起使用。

I had this problem.. It's the Python Interface...
By Default, Python 2.4 is installed on CentOS, and ot's not easy to upgrade to >2.6.

When OpenCV builds, it is confused by the Python version...

So I've disable the Python interface on "cmake" and it was OK.

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_NEW_PYTHON_SUPPORT=NO ..

But, of course you can not use OpenCV with Python anymore.

失去的东西太少 2024-09-08 09:52:55

Python 函数 all() 是在 2.5 版本中引入的。您可能正在使用 Python 语言中尚不存在 all() 的版本进行编译。

根据Python 内置函数列表all() 相当于:

def all(iterable):
    for element in iterable:
        if not element:
            return False
    return True

您可能还需要定义 any()。它相当于:

def any(iterable):
    for element in iterable:
        if element:
            return True
    return False

不过,如果安装脚本很可能需要 Python 2.5,那么 Python 包装器的其余部分也将如此。

The Python function all() was introduced with version 2.5. You are probably compiling with a version where all() does not exist in the Python language yet.

According to the Python Built-in Functions List, all() is equivalent to:

def all(iterable):
    for element in iterable:
        if not element:
            return False
    return True

You may also need to define any(). It is the equivalent of:

def any(iterable):
    for element in iterable:
        if element:
            return True
    return False

More than likely though, if the setup script requires Python 2.5, so will the rest of the Python wrapper.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文