Hi Bram,

After installing vim7.3 on a ubuntu system, I had again the problem that import did not work for .so libraries in lib-dynload. I found that sys.path was initialized with "/usr/..." instead of "/usr/local/...". On ubuntu (and probably on other linux distros as well) python3 is installed in /usr/local while python2 is installed in /usr.

The attached patch calls Py_SetPythonHome with PYTHON3_PREFIX defined by configure.
This solves the problem.

regards, Roland

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
diff -r ee53a39d5896 src/auto/configure
--- a/src/auto/configure	Sun Aug 15 15:24:20 2010 +0200
+++ b/src/auto/configure	Sun Nov 07 12:06:52 2010 +0100
@@ -5560,9 +5560,9 @@
 
       PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
       if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then
-        PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}"
+        PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -DPYTHON3_PREFIX=L\\\"${vi_cv_path_python3_pfx}\\\""
       else
-        PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}"
+        PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version} -DPYTHON3_PREFIX=L\\\"${vi_cv_path_python3_pfx}\\\""
       fi
       PYTHON3_SRC="if_python3.c"
             if test "x$MACOSX" = "xyes"; then
diff -r ee53a39d5896 src/configure.in
--- a/src/configure.in	Sun Aug 15 15:24:20 2010 +0200
+++ b/src/configure.in	Sun Nov 07 12:06:52 2010 +0100
@@ -1029,9 +1029,9 @@
 
       PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
       if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then
-        PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}"
+        PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -DPYTHON3_PREFIX=L\\\"${vi_cv_path_python3_pfx}\\\""
       else
-        PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}"
+        PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version} -DPYTHON3_PREFIX=L\\\"${vi_cv_path_python3_pfx}\\\""
       fi
       PYTHON3_SRC="if_python3.c"
       dnl For Mac OSX 10.2 config.o is included in the Python library.
diff -r ee53a39d5896 src/if_python3.c
--- a/src/if_python3.c	Sun Aug 15 15:24:20 2010 +0200
+++ b/src/if_python3.c	Sun Nov 07 12:06:52 2010 +0100
@@ -132,6 +132,7 @@
 # define PyType_Ready py3_PyType_Ready
 #undef Py_BuildValue
 # define Py_BuildValue py3_Py_BuildValue
+# define Py_SetPythonHome py3_Py_SetPythonHome
 # define Py_Initialize py3_Py_Initialize
 # define Py_Finalize py3_Py_Finalize
 # define Py_IsInitialized py3_Py_IsInitialized
@@ -170,6 +171,7 @@
  * Pointers for dynamic link
  */
 static int (*py3_PySys_SetArgv)(int, wchar_t **);
+static void (*py3_Py_SetPythonHome)(wchar_t *home);
 static void (*py3_Py_Initialize)(void);
 static PyObject* (*py3_PyList_New)(Py_ssize_t size);
 static PyGILState_STATE (*py3_PyGILState_Ensure)(void);
@@ -254,6 +256,7 @@
 } py3_funcname_table[] =
 {
     {"PySys_SetArgv", (PYTHON_PROC*)&py3_PySys_SetArgv},
+    {"Py_SetPythonHome", (PYTHON_PROC*)&py3_Py_SetPythonHome},
     {"Py_Initialize", (PYTHON_PROC*)&py3_Py_Initialize},
     {"PyArg_ParseTuple", (PYTHON_PROC*)&py3_PyArg_ParseTuple},
     {"PyList_New", (PYTHON_PROC*)&py3_PyList_New},
@@ -539,6 +542,11 @@
 
 	init_structs();
 
+
+#ifdef PYTHON3_PREFIX
+        Py_SetPythonHome(PYTHON3_PREFIX);
+#endif
+
 	/* initialise threads */
 	PyEval_InitThreads();
 

Raspunde prin e-mail lui