【发布时间】:2021-08-07 13:29:36
【问题描述】:
我正在尝试使用 arrow-cpp 来构建一个表,然后将其传输回 python。
为此,我需要事先调用 arrow::py::import_pyarrow(),但这会导致 SEGFAULT。
谁能帮忙找出我哪里做错了?
这是一个最小的例子
CMakeLists.txt
cmake_minimum_required(VERSION 3.20.0)
project(TEST)
set(CMAKE_CXX_STANDARD 17)
set(Python3_EXECUTABLE "/home/auderson/miniconda3/bin/python3.8")
list(APPEND CMAKE_PREFIX_PATH "/home/auderson/miniconda3/lib/cmake/arrow")
find_package(Arrow REQUIRED)
find_package(ArrowPython REQUIRED)
find_package(Python3 COMPONENTS Interpreter Development)
include_directories(.
/home/auderson/miniconda3/lib/python3.8/site-packages/pyarrow/include
${Python3_INCLUDE_DIRS})
add_executable(TEST
mini_t.cpp
)
target_link_libraries(${PROJECT_NAME} PRIVATE arrow_shared)
target_link_libraries(${PROJECT_NAME} PRIVATE arrow_python_shared)
target_link_libraries(${PROJECT_NAME} PRIVATE ${Python3_LIBRARIES})
cpp 文件
#include "arrow/python/pyarrow.h"
int main() {
return arrow::py::import_pyarrow();
}
输出(调试模式)
Signal: SIGSEGV (Segmentation fault)
Process finished with exit code 1
如果不是调试模式:
Process finished with exit code 139
箭头的其他功能也很好用。
【问题讨论】:
标签: c++ python-3.x pyarrow apache-arrow