We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tags/v2.10.4
the standard procedure to embed python in c++ using pybind lead to missing home libraries from sys.path.
sys.path
CMakeLists.txt :
cmake_minimum_required(VERSION 3.1) include(FetchContent) add_executable(main ./main.cpp) FetchContent_Declare( pybind11 GIT_REPOSITORY https://github.com/pybind/pybind11.git GIT_TAG v2.10.4 ) FetchContent_GetProperties(pybind11) if(NOT pybind11_POPULATED) FetchContent_Populate(pybind11) add_subdirectory(./build/_deps/pybind11-src) endif() target_link_libraries(main pybind11::embed)
main.cpp
#include <pybind11/stl.h> #include <pybind11/pybind11.h> #include <pybind11/embed.h> #include <pybind11/numpy.h> namespace py = pybind11; int main() { py::scoped_interpreter guard{}; py::exec("import sys\nprint(sys.path)"); }
running gives :
> cmake -B build . > cd build > make > ./main ['', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/usr/lib/python3.10/site-packages']
in normal python :
In [1]: import sys In [2]: print(sys.path) ['/usr/bin', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '', '/home/xxx/.local/lib/python3.10/site-packages', '/usr/lib/python3.10/site-packages']
Not a regression
The text was updated successfully, but these errors were encountered:
May be related with #4471.
Sorry, something went wrong.
Yes but the issue still exist, with the fix described by the PR ...
No branches or pull requests
Required prerequisites
What version (or hash if on master) of pybind11 are you using?
tags/v2.10.4
Problem description
the standard procedure to embed python in c++ using pybind lead to missing home libraries from
sys.path
.Reproducible example code
CMakeLists.txt :
main.cpp
running gives :
in normal python :
Is this a regression? Put the last known working version here if it is.
Not a regression
The text was updated successfully, but these errors were encountered: