From d25357e5792f2db98627001537bd4ac00783ad51 Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Fri, 14 Apr 2017 16:10:56 +0800 Subject: [PATCH] Fix PyHome Setted in PythonUtil.cpp * set PYTHON_HOME outside the paddle processes. --- paddle/utils/.gitignore | 1 - paddle/utils/CMakeLists.txt | 3 --- paddle/utils/{PythonUtil.cpp.in => PythonUtil.cpp} | 9 --------- 3 files changed, 13 deletions(-) rename paddle/utils/{PythonUtil.cpp.in => PythonUtil.cpp} (95%) diff --git a/paddle/utils/.gitignore b/paddle/utils/.gitignore index 956b606a18c..f2cfd740941 100644 --- a/paddle/utils/.gitignore +++ b/paddle/utils/.gitignore @@ -1,2 +1 @@ enable_virtualenv.c -PythonUtil.cpp diff --git a/paddle/utils/CMakeLists.txt b/paddle/utils/CMakeLists.txt index 10d906ee166..171eae381af 100644 --- a/paddle/utils/CMakeLists.txt +++ b/paddle/utils/CMakeLists.txt @@ -1,7 +1,4 @@ # The utilities for paddle - -configure_file(PythonUtil.cpp.in ${PROJ_ROOT}/paddle/utils/PythonUtil.cpp) - file(GLOB UTIL_HEADERS . *.h) file(GLOB UTIL_SOURCES . *.cpp) create_resources(enable_virtualenv.py enable_virtualenv.c) diff --git a/paddle/utils/PythonUtil.cpp.in b/paddle/utils/PythonUtil.cpp similarity index 95% rename from paddle/utils/PythonUtil.cpp.in rename to paddle/utils/PythonUtil.cpp index a51b8f765f4..7faeff55c28 100644 --- a/paddle/utils/PythonUtil.cpp.in +++ b/paddle/utils/PythonUtil.cpp @@ -195,15 +195,6 @@ extern const char enable_virtualenv_py[]; } void initPython(int argc, char** argv) { #ifndef PADDLE_NO_PYTHON - std::string pyHome; -#if defined(__APPLE__) || defined(__OSX__) - pyHome = "/usr/local/Frameworks/Python.framework/Versions/2.7"; - Py_SetPythonHome(const_cast(pyHome.c_str())); -#endif - pyHome = "@PYTHON_INSTALL_DIR@"; // NOLINT - if (!pyHome.empty()) { - Py_SetPythonHome(const_cast(pyHome.c_str())); - } Py_SetProgramName(argv[0]); Py_Initialize(); PySys_SetArgv(argc, argv); -- GitLab