When trying from osgeo import gdal I got the error ModuleNotFoundError: No module named '_gdal'. I installed gdal 3.5.1 from binary.
ModuleNotFoundError: No module named '_gdal'
20 views Asked by Rémy Ntshaykolo At
1
When trying from osgeo import gdal I got the error ModuleNotFoundError: No module named '_gdal'. I installed gdal 3.5.1 from binary.
Try
gdalinfo --versionif you have an error like this :gdalinfo: error while loading shared libraries: libgdal.so.31: cannot open shared object file: No such file or directorydo this:find / -name libgdal.so*. for me the result was :/usr/local/lib64/libgdal.so.31libgdal.so.31should be part of $LD_LIBRARY_PATH. If it is not: add it withLD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path_to_your_libraryfor my case it isexport LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATHgdalinfo --version, if it works try again to import gdal :from osgeo import gdal=> Celebrate. Ifgdalinfo --versionstill work, repeat the process for error message specified libraries => celebrate