python doesn't recognize the pybind11 module "import error not found" #3772
Unanswered
amirsarusi
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
hey, i started working on windows (visual studio 2019) with pybind and everything worked well in terms of the imports and actually being able to use my cpp code in the python interpeter. last week we moved to linux and for some reason the same code that works for windows doesn't do so, and the python interpeter cant recognize the .so file even if its in the same directory.
my build system is cmake and it looks like this (very basic cmake):
`cmake_minimum_required(VERSION 3.10)
include_directories(${OpenCV_INCLUDE_DIRS})
project(PYTHON_BINDINGS C CXX)
set(CMAKE_CXX_STANDARD 17)
For inuitive camera board
set(INUDEV_VERSION inudev-4.12.0009.123)
include_directories("/opt/${INUDEV_VERSION}/Inuitive/InuDev/include/")
link_directories("/opt/${INUDEV_VERSION}/Inuitive/InuDev/lib/")
link_directories("/opt/${INUDEV_VERSION}/Inuitive/InuDev")
find_package(PythonLibs 3 REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})
add_subdirectory(pybind11)
pybind11_add_module(InuCam MODULE camera.h camera.cpp)
target_include_directories( InuCam
$<BUILD_INTERFACE:$ {CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:$ {CMAKE_CURRENT_SOURCE_DIR}/pybind11/include/> )
INTERFACE
set_target_properties( InuCam
PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
PREFIX ""
)`
once i tell it to build i see a .so file that appears, but when i try to import the library (InuCam) it doesn't recognize it.
has anyone every experienced that? i can also say that i've tried running basic examples and my python hasnt been able to import any library
Beta Was this translation helpful? Give feedback.
All reactions