如何從python獲取已安裝的GDAL/OGR版本?如何從python獲取已安裝的GDAL/OGR版本?
我知道gdal-config
程序和正在使用下列內容:
In [3]: import commands
In [4]: commands.getoutput('gdal-config --version')
Out[4]: '1.7.2'
不過,我懷疑是有辦法做到這一點使用Python API本身。任何骰子?
如何從python獲取已安裝的GDAL/OGR版本?如何從python獲取已安裝的GDAL/OGR版本?
我知道gdal-config
程序和正在使用下列內容:
In [3]: import commands
In [4]: commands.getoutput('gdal-config --version')
Out[4]: '1.7.2'
不過,我懷疑是有辦法做到這一點使用Python API本身。任何骰子?
gdal.VersionInfo()
我想要做什麼:
>>> osgeo.gdal.VersionInfo()
'1604'
這個適用於我的Windows盒子和Ubuntu安裝。 gdal.__version__
在我的Windows安裝中給出了一個錯誤,雖然它適用於我的Ubuntu安裝:
>>> import osgeo.gdal
>>> print osgeo.gdal.__version__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute '__version__'
的osgeo.gdal模塊中的__version__
特性是包含版本號
import osgeo.gdal
print osgeo.gdal.__version__
在我的Ubuntu機器串給出:
>> '1.6.3'
無法在我的Windows盒子上工作:( – fmark 2010-07-13 13:41:29