gpt4 book ai didi

python - mod_wsgi错误:ImportError:dlopen(/usr/local/lib/python3.6/site-packages/cv2.so,2):找不到符号:_iconv

转载 作者:行者123 更新时间:2023-12-02 17:09:58 25 4
gpt4 key购买 nike

我正在配置一个Python应用程序,该应用程序在MacOSx(El Capitan)系统上将OpenCV与Apache(XAMPP)一起使用。而且,我正在使用mod_wsgi。按照安装指南,已成功(正确)使用Python3.6和XAMPP的apache版本构建了mod_wsgi。

我之前曾使用mod_wsgi将Python应用程序(无OpenCV)与Apache一起使用过,并且它已经正常工作。

但是,我现在有了另一个使用OpenCV的应用程序,但我没有任何想法,但收到以下错误(来自Apache的错误日志),而且我在互联网上没有找到类似的东西:

[Tue Jul 18 12:12:53.547655 2017] [wsgi:error] [pid 19030] [remote ::1:51718]
import cv2
[Tue Jul 18 12:12:53.547686 2017] [wsgi:error] [pid 19030] [remote ::1:51718]
ImportError: dlopen(/usr/local/lib/python3.6/site-packages/cv2.so, 2): Symbol not found: _iconv
[Tue Jul 18 12:12:53.547698 2017] [wsgi:error] [pid 19030] [remote ::1:51718]
Referenced from: /System/Library/PrivateFrameworks/LanguageModeling.framework/Versions/A/LanguageModeling
[Tue Jul 18 12:12:53.547706 2017] [wsgi:error] [pid 19030] [remote ::1:51718] Expected in: /Applications/XAMPP/xamppfiles/lib/libiconv.2.dylib
[Tue Jul 18 12:12:53.547713 2017] [wsgi:error] [pid 19030] [remote ::1:51718] in /System/Library/PrivateFrameworks/LanguageModeling.framework/Versions/A/LanguageModeling

/usr/local/lib/python3.6/site-packages/cv2.so 的输出:
@rpath/libopencv_shape.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_superres.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_stitching.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_videostab.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_objdetect.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_photo.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_video.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_calib3d.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_features2d.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_flann.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_ml.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_highgui.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_videoio.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_imgcodecs.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_imgproc.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
@rpath/libopencv_core.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 307.4.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)

最佳答案

看起来当编译cv2的C扩展时,它假定libiconv库已经链接到Python可执行文件中,而不是仍然自己链接。当将Python嵌入Apache中时,由于Apache不在libiconv库中进行链接,因此该函数丢失。

解决方法是,将以下行添加到任何VirtualHost定义之外的Apache配置中。

LoadFile /usr/lib/libiconv.dylib

关于python - mod_wsgi错误:ImportError:dlopen(/usr/local/lib/python3.6/site-packages/cv2.so,2):找不到符号:_iconv,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45164325/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com