First, compile the Python version of gdal. For details about the compilation, refer to the previous blog gdal's swig compilation. The URL is http://blog.csdn.net/liminlu0314/article/details/6945452. Or download the compiled version.
Copy all downloaded files to the Lib \ Site-packages folder under the python installation directory, as shown in:
Then, open Python and enter:
Import osgeo. gdal
Press enter. If an error is displayed, the installation is successful. If no, the installation is successful. A piece of test code:
From osgeo import gdalfrom osgeo. gdalconst import * dataset = gdal. open ("F: \ work \ data \ envi. IMG ", ga_readonly) dataset. getdriver (). shortname # 'envi' # image format dataset. getprojectionref () # 'projcs ["unnamed", geogcs ["nad83", datum ["north_american_datum_1983", spheroid ["GRs 1980", 6378137,298.257222101, authority ["epsg ", "7019"], towgs84 [0, 0, 0, 0, 0], authority ["epsg", "6269"], primem ["Greenwich", 0, authority ["epsg", "8901"], Unit ["degree", 0.0174532925199433, authority ["epsg", "9108"], authority ["epsg ", "4269"], projection ["transverse_mercator"], parameter ["latitude_of_origin", 30], parameter ["central_meridian",-84.16666666666667], parameter ["scale_factor ", 0.9999], parameter ["false_easting", 2296587.926509186], parameter ["false_northing", 0], Unit ["foot (international)", 0.3048] '# image projection Information