Guest User

Switch 32-bit GDAL to 64-bit GDAL

a guest
Jan 3rd, 2016
102
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import os, sys
  2. print sys.prefix #Python location
  3.  
  4. #change GDAL_DATA for 64-bit version
  5.  
  6. gdalData64 = 'C:\Program Files\GDAL\gdal-data' #path to 64-bit GDAl data
  7. os.environ['GDAL_DATA'] = gdalData64 #change value of GDAL_DATA
  8. print os.environ['GDAL_DATA']
  9.  
  10. #change PATH for 64-bit version
  11.  
  12. pathVar32 = 'C:\Program Files (x86)\GDAL' #path to 32-bit GDAL
  13. pathVar64 = 'C:\Program Files\GDAL' #path to 64-bit GDAL
  14. if pathVar32 in os.environ['PATH']: #if 32-bit GDAL path is found
  15.     os.environ['PATH'] = os.environ['PATH'].replace(pathVar32, pathVar64) #switch 32-bit GDAL to 64-bit GDAL
  16.  
  17. print os.environ['PATH']
  18.  
  19. #import should work now
  20. import ogr, gdal
RAW Paste Data