2

As I am working in ubuntu. This works if I deactivate the virtual environment but after activating the environment I got the error saying no module named osgeo.

How do I install it?

from osgeo import ogr, osr
0

1 Answer 1

2

As I am able to solve this by installing libgdal-dev and pygdal (Virtualenv and setuptools friendly version of standard GDAL python bindings.)

sudo apt-get install libgdal-dev

In case not installed, install using aptitude

sudo aptitude install libgdal-dev

After that check GDAL version of your system,

gdalinfo --version

lets say you have GDAL version as

GDAL 2.2.3, released 2017/11/20

Then install pygdal of same version of GDAL

pip install pygdal==2.2.3.3

Also I am able to install with single command

pip install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version`    
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.