From cfb1c3e9686f1a4ca5a5444f6b4396e9253b400f Mon Sep 17 00:00:00 2001 From: Tomas Touceda Date: Thu, 20 Jun 2013 16:46:13 -0300 Subject: Improve "bundlelization" by setting PYTHONPATH and PYTHONHOME properly --- src/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 2c0954b..ee5725a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -117,10 +118,11 @@ main(int argc, char** argv) fs::path full_path(fs::current_path()); updateIfNeeded(); - - Py_Initialize(); + auto pypath = full_path.string() + ":" + full_path.string() + "/lib/"; + setenv("PYTHONPATH", pypath.c_str(), 1); Py_SetPythonHome(const_cast(full_path.string().c_str())); + Py_Initialize(); py::object main_module = py::import("__main__"); py::object global = (main_module.attr("__dict__")); -- cgit v1.2.3