安装 dlib python 模块出现段错误
Installing dlib python module getting segfault
我正在尝试安装 dlib python 模块,但每次我尝试导入它时,我都会遇到段错误并且 python 像这样崩溃。
└[~/Devspace/dlib]> python
Python 2.7.10 (default, Sep 23 2015, 04:34:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.72)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import dlib
[1] 50326 segmentation fault python
我没有收到任何其他错误消息,因此我不确定如何解决此问题。我在 OS X 上使用自制软件安装了 boost 和 python(并在系统 python 上进行了符号链接)。我一直在四处搜索,发现这通常是由不兼容版本的 boost 和python,这可能是由于在系统 python 中使用自制版本的库造成的。我相当确定这是某种原因,但 CMake 在编译时告诉我这个
-- Detecting CXX compile features - done
-- Boost version: 1.59.0
-- Found the following Boost libraries:
-- python
-- Found PythonLibs: /usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib (found suitable version "2.7.10", minimum required is "2.6")
-- USING BOOST_LIBS: /usr/local/lib/libboost_python-mt.dylib
-- USING PYTHON_LIBS: /usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib
-- Enabling SSE4 instructions
*****************************************************************************
所以我知道 python 库和增强库都来自自制程序管理 /usr/local/bin
而不是系统管理 /usr/bin/
。 Make 完成得很好并且 returns 成功,甚至似乎安装一切都很好。
Install the project...
-- Install configuration: "Release"
-- Installing: /Users/gabriel/Devspace/dlib/tools/python/../../python_examples/dlib.so
Populating the distribution directory /Users/gabriel/Devspace/dlib/./dist/dlib ...
Copying file /Users/gabriel/Devspace/dlib/./python_examples/correlation_tracker.py -> /Users/gabriel/Devspace/dlib/./dist/dlib/examples/correlation_tracker.py.
Copying file /Users/gabriel/Devspace/dlib/./python_examples/dlib.so -> /Users/gabriel/Devspace/dlib/./dist/dlib/dlib.so.
Copying file /Users/gabriel/Devspace/dlib/./python_examples/face_detector.py -> /Users/gabriel/Devspace/dlib/./dist/dlib/examples/face_detector.py.
Copying file /Users/gabriel/Devspace/dlib/./python_examples/face_landmark_detection.py -> /Users/gabriel/Devspace/dlib/./dist/dlib/examples/face_landmark_detection.py.
Copying file /Users/gabriel/Devspace/dlib/./python_examples/find_candidate_object_locations.py -> /Users/gabriel/Devspace/dlib/./dist/dlib/examples/find_candidate_object_locations.py.
Copying file /Users/gabriel/Devspace/dlib/./python_examples/LICENSE_FOR_EXAMPLE_PROGRAMS.txt -> /Users/gabriel/Devspace/dlib/./dist/dlib/examples/LICENSE_FOR_EXAMPLE_PROGRAMS.txt.
Copying file /Users/gabriel/Devspace/dlib/./python_examples/max_cost_assignment.py -> /Users/gabriel/Devspace/dlib/./dist/dlib/examples/max_cost_assignment.py.
Copying file /Users/gabriel/Devspace/dlib/./python_examples/sequence_segmenter.py -> /Users/gabriel/Devspace/dlib/./dist/dlib/examples/sequence_segmenter.py.
Copying file /Users/gabriel/Devspace/dlib/./python_examples/svm_rank.py -> /Users/gabriel/Devspace/dlib/./dist/dlib/examples/svm_rank.py.
Copying file /Users/gabriel/Devspace/dlib/./python_examples/svm_struct.py -> /Users/gabriel/Devspace/dlib/./dist/dlib/examples/svm_struct.py.
Copying file /Users/gabriel/Devspace/dlib/./python_examples/train_object_detector.py -> /Users/gabriel/Devspace/dlib/./dist/dlib/examples/train_object_detector.py.
Copying file /Users/gabriel/Devspace/dlib/./python_examples/train_shape_predictor.py -> /Users/gabriel/Devspace/dlib/./dist/dlib/examples/train_shape_predictor.py.
running build_py
creating build
creating build/lib.macosx-10.11-x86_64-2.7
creating build/lib.macosx-10.11-x86_64-2.7/dlib
copying dist/dlib/__init__.py -> build/lib.macosx-10.11-x86_64-2.7/dlib
running egg_info
creating dist/dlib.egg-info
writing dist/dlib.egg-info/PKG-INFO
writing top-level names to dist/dlib.egg-info/top_level.txt
writing dependency_links to dist/dlib.egg-info/dependency_links.txt
writing manifest file 'dist/dlib.egg-info/SOURCES.txt'
reading manifest file 'dist/dlib.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '**' found under directory 'dlib/build'
warning: no files found matching '*.bat' under directory 'python_examples'
warning: no previously-included files matching '**' found under directory 'python_examples/build'
writing manifest file 'dist/dlib.egg-info/SOURCES.txt'
copying dist/dlib/dlib.so -> build/lib.macosx-10.11-x86_64-2.7/dlib
creating build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/LICENSE_FOR_EXAMPLE_PROGRAMS.txt -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/__init__.py -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/correlation_tracker.py -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/face_detector.py -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/face_landmark_detection.py -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/find_candidate_object_locations.py -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/max_cost_assignment.py -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/sequence_segmenter.py -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/svm_rank.py -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/svm_struct.py -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/train_object_detector.py -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/train_shape_predictor.py -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
running build_ext
之后安装在我的python站点包中,可以用pip查看
└[~/Devspace/dlib]> pip freeze
appnope==0.1.0
colorama==0.3.3
cv2==1.0
cycler==0.9.0
decorator==4.0.4
dlib==18.18.99
gnureadline==6.3.3
imutils==0.3
但如果我尝试导入它,它总是会导致段错误。我正在使用随附的 setup.py
进行安装,我想如果 python/boost 不匹配,我可能需要 运行 CMake 自己,但它们对我来说看起来不错。有人对我有什么建议吗?任何帮助将不胜感激。
请参阅我的回答 . I submitted a PR,它在 OS X 上为我处理了 Python。
我正在尝试安装 dlib python 模块,但每次我尝试导入它时,我都会遇到段错误并且 python 像这样崩溃。
└[~/Devspace/dlib]> python
Python 2.7.10 (default, Sep 23 2015, 04:34:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.72)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import dlib
[1] 50326 segmentation fault python
我没有收到任何其他错误消息,因此我不确定如何解决此问题。我在 OS X 上使用自制软件安装了 boost 和 python(并在系统 python 上进行了符号链接)。我一直在四处搜索,发现这通常是由不兼容版本的 boost 和python,这可能是由于在系统 python 中使用自制版本的库造成的。我相当确定这是某种原因,但 CMake 在编译时告诉我这个
-- Detecting CXX compile features - done
-- Boost version: 1.59.0
-- Found the following Boost libraries:
-- python
-- Found PythonLibs: /usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib (found suitable version "2.7.10", minimum required is "2.6")
-- USING BOOST_LIBS: /usr/local/lib/libboost_python-mt.dylib
-- USING PYTHON_LIBS: /usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib
-- Enabling SSE4 instructions
*****************************************************************************
所以我知道 python 库和增强库都来自自制程序管理 /usr/local/bin
而不是系统管理 /usr/bin/
。 Make 完成得很好并且 returns 成功,甚至似乎安装一切都很好。
Install the project...
-- Install configuration: "Release"
-- Installing: /Users/gabriel/Devspace/dlib/tools/python/../../python_examples/dlib.so
Populating the distribution directory /Users/gabriel/Devspace/dlib/./dist/dlib ...
Copying file /Users/gabriel/Devspace/dlib/./python_examples/correlation_tracker.py -> /Users/gabriel/Devspace/dlib/./dist/dlib/examples/correlation_tracker.py.
Copying file /Users/gabriel/Devspace/dlib/./python_examples/dlib.so -> /Users/gabriel/Devspace/dlib/./dist/dlib/dlib.so.
Copying file /Users/gabriel/Devspace/dlib/./python_examples/face_detector.py -> /Users/gabriel/Devspace/dlib/./dist/dlib/examples/face_detector.py.
Copying file /Users/gabriel/Devspace/dlib/./python_examples/face_landmark_detection.py -> /Users/gabriel/Devspace/dlib/./dist/dlib/examples/face_landmark_detection.py.
Copying file /Users/gabriel/Devspace/dlib/./python_examples/find_candidate_object_locations.py -> /Users/gabriel/Devspace/dlib/./dist/dlib/examples/find_candidate_object_locations.py.
Copying file /Users/gabriel/Devspace/dlib/./python_examples/LICENSE_FOR_EXAMPLE_PROGRAMS.txt -> /Users/gabriel/Devspace/dlib/./dist/dlib/examples/LICENSE_FOR_EXAMPLE_PROGRAMS.txt.
Copying file /Users/gabriel/Devspace/dlib/./python_examples/max_cost_assignment.py -> /Users/gabriel/Devspace/dlib/./dist/dlib/examples/max_cost_assignment.py.
Copying file /Users/gabriel/Devspace/dlib/./python_examples/sequence_segmenter.py -> /Users/gabriel/Devspace/dlib/./dist/dlib/examples/sequence_segmenter.py.
Copying file /Users/gabriel/Devspace/dlib/./python_examples/svm_rank.py -> /Users/gabriel/Devspace/dlib/./dist/dlib/examples/svm_rank.py.
Copying file /Users/gabriel/Devspace/dlib/./python_examples/svm_struct.py -> /Users/gabriel/Devspace/dlib/./dist/dlib/examples/svm_struct.py.
Copying file /Users/gabriel/Devspace/dlib/./python_examples/train_object_detector.py -> /Users/gabriel/Devspace/dlib/./dist/dlib/examples/train_object_detector.py.
Copying file /Users/gabriel/Devspace/dlib/./python_examples/train_shape_predictor.py -> /Users/gabriel/Devspace/dlib/./dist/dlib/examples/train_shape_predictor.py.
running build_py
creating build
creating build/lib.macosx-10.11-x86_64-2.7
creating build/lib.macosx-10.11-x86_64-2.7/dlib
copying dist/dlib/__init__.py -> build/lib.macosx-10.11-x86_64-2.7/dlib
running egg_info
creating dist/dlib.egg-info
writing dist/dlib.egg-info/PKG-INFO
writing top-level names to dist/dlib.egg-info/top_level.txt
writing dependency_links to dist/dlib.egg-info/dependency_links.txt
writing manifest file 'dist/dlib.egg-info/SOURCES.txt'
reading manifest file 'dist/dlib.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '**' found under directory 'dlib/build'
warning: no files found matching '*.bat' under directory 'python_examples'
warning: no previously-included files matching '**' found under directory 'python_examples/build'
writing manifest file 'dist/dlib.egg-info/SOURCES.txt'
copying dist/dlib/dlib.so -> build/lib.macosx-10.11-x86_64-2.7/dlib
creating build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/LICENSE_FOR_EXAMPLE_PROGRAMS.txt -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/__init__.py -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/correlation_tracker.py -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/face_detector.py -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/face_landmark_detection.py -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/find_candidate_object_locations.py -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/max_cost_assignment.py -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/sequence_segmenter.py -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/svm_rank.py -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/svm_struct.py -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/train_object_detector.py -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
copying dist/dlib/examples/train_shape_predictor.py -> build/lib.macosx-10.11-x86_64-2.7/dlib/examples
running build_ext
之后安装在我的python站点包中,可以用pip查看
└[~/Devspace/dlib]> pip freeze
appnope==0.1.0
colorama==0.3.3
cv2==1.0
cycler==0.9.0
decorator==4.0.4
dlib==18.18.99
gnureadline==6.3.3
imutils==0.3
但如果我尝试导入它,它总是会导致段错误。我正在使用随附的 setup.py
进行安装,我想如果 python/boost 不匹配,我可能需要 运行 CMake 自己,但它们对我来说看起来不错。有人对我有什么建议吗?任何帮助将不胜感激。
请参阅我的回答