Hi,


I'm trying to build GDAL bindings for Python 3. I have the gdal-2.2.2-1 package 
installed from the Arch Linux official repositories, which does contain 
bindings for Python 2.7.



PYTHONPATH=/usr/lib/python2.7/site-packages/osgeo
python2

from osgeo import gdal

exit()



python3

from osgeo import gdal

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'osgeo'



But when I try to build the bindings for Python 3myself (have tried using the 
python-gdal package from Arch's AUR, building it manually, and using 
easy_install GDAL), I get the following error:

➜  Desktop sudo easy_install GDAL       
Searching for GDAL
Reading https://pypi.python.org/simple/GDAL/
Downloading 
https://pypi.python.org/packages/11/cd/edef955a6ef6cb4f2113647d7465b34663e074451b66919e734466ba5197/GDAL-2.2.2.tar.gz#md5=bc5a58ec0e82420fdc910bafc3b5800a
Best match: GDAL 2.2.2
Processing GDAL-2.2.2.tar.gz
Writing /tmp/easy_install-jom80hpq/GDAL-2.2.2/setup.cfg
Running GDAL-2.2.2/setup.py -q bdist_egg --dist-dir 
/tmp/easy_install-jom80hpq/GDAL-2.2.2/egg-dist-tmp-tf275y_9
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC 
but not for C++
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC 
but not for C++
extensions/osr_wrap.cpp:3339:13: warning: ‘void GDALPythonFreeCStr(void*, int)’ 
defined but not used [-Wunused-function]
 static void GDALPythonFreeCStr(void* ptr, int bToFree)
             ^~~~~~~~~~~~~~~~~~
extensions/osr_wrap.cpp:3309:14: warning: ‘char* 
GDALPythonObjectToCStr(PyObject*, int*)’ defined but not used 
[-Wunused-function]
 static char* GDALPythonObjectToCStr(PyObject* pyObject, int* pbToFree)
              ^~~~~~~~~~~~~~~~~~~~~~
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC 
but not for C++
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC 
but not for C++
extensions/gnm_wrap.cpp:3321:13: warning: ‘void GDALPythonFreeCStr(void*, int)’ 
defined but not used [-Wunused-function]
 static void GDALPythonFreeCStr(void* ptr, int bToFree)
             ^~~~~~~~~~~~~~~~~~
extensions/gnm_wrap.cpp:3291:14: warning: ‘char* 
GDALPythonObjectToCStr(PyObject*, int*)’ defined but not used 
[-Wunused-function]
 static char* GDALPythonObjectToCStr(PyObject* pyObject, int* pbToFree)
              ^~~~~~~~~~~~~~~~~~~~~~
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC 
but not for C++
In file included from /usr/include/python3.6m/numpy/ndarraytypes.h:1809:0,
                 from /usr/include/python3.6m/numpy/ndarrayobject.h:18,
                 from /usr/include/python3.6m/numpy/arrayobject.h:4,
                 from extensions/gdal_array_wrap.cpp:3464:
/usr/include/python3.6m/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using 
deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API 
NPY_1_7_API_VERSION" [-Wcpp]
 #warning "Using deprecated NumPy API, disable it by " \
  ^~~~~~~
extensions/gdal_array_wrap.cpp: In function ‘void GDALRegister_NUMPY()’:
extensions/gdal_array_wrap.cpp:3528:45: error: ‘GDALCreateDriver’ was not 
declared in this scope
         poDriver = static_cast<GDALDriver*>(GDALCreateDriver());
                                             ^~~~~~~~~~~~~~~~
extensions/gdal_array_wrap.cpp:3528:45: note: suggested alternative: 
‘GDALGetDriver’
         poDriver = static_cast<GDALDriver*>(GDALCreateDriver());
                                             ^~~~~~~~~~~~~~~~
                                             GDALGetDriver
extensions/gdal_array_wrap.cpp: At global scope:
extensions/gdal_array_wrap.cpp:3448:13: warning: ‘void 
GDALPythonFreeCStr(void*, int)’ defined but not used [-Wunused-function]
 static void GDALPythonFreeCStr(void* ptr, int bToFree)
             ^~~~~~~~~~~~~~~~~~
extensions/gdal_array_wrap.cpp:3418:14: warning: ‘char* 
GDALPythonObjectToCStr(PyObject*, int*)’ defined but not used 
[-Wunused-function]
 static char* GDALPythonObjectToCStr(PyObject* pyObject, int* pbToFree)
              ^~~~~~~~~~~~~~~~~~~~~~
error: Setup script exited with error: command 'gcc' failed with exit status 1


Any ideas? Thanks.
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to