Skip to content

Commit

Permalink
setup PYTHONPATH and HOME in pyenv
Browse files Browse the repository at this point in the history
  • Loading branch information
littlemine committed Jul 9, 2024
1 parent 3b3cd93 commit c5101c4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions projects/PyZpc/pyzfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ static callback_t zpc_init_callback = [] (auto _) {
#endif
auto zeno_lib_path = exe_dir + "/" + ZENO_PYZPC_DLL_FILE;
auto py_libs_dir = exe_dir + "/resource/py_libs";
if (PyRun_SimpleString("import sys; sys.path.append('C\:/Develop/vcpkg/installed/x64-windows/tools/python3/DLLs'); ") < 0) {
if (PyRun_SimpleString(("import os; os.environ['PYTHONPATH'] = '" + exe_dir + "/DLLs';").c_str()) < 0) {
log_warn("Failed to initialize Python module");
return;
}
if (PyRun_SimpleString(("os.environ['PYTHONHOME'] = '" + exe_dir + "';").c_str()) < 0) {
log_warn("Failed to initialize Python module");
return;
}
Expand All @@ -61,7 +65,7 @@ static callback_t zpc_init_callback = [] (auto _) {
return;
}
#endif
if (PyRun_SimpleString(("sys.path.append('" +
if (PyRun_SimpleString(("import sys; sys.path.append('" +
py_libs_dir + "'); import zpy; zpy.init_zeno_lib('" + zeno_lib_path +
"'); zpy.zeno_lib_path = '" + zeno_lib_path + "'").c_str()) < 0) {
log_warn("Failed to initialize Python module");
Expand Down

0 comments on commit c5101c4

Please sign in to comment.