【问题标题】:Why does gdalinfo --version show different outputs when run on terminal as compared to when run through python?为什么 gdalinfo --version 在终端上运行时与通过 python 运行时显示不同的输出?
【发布时间】:2018-02-16 16:26:44
【问题描述】:

为什么 gdalinfo --version 在终端上运行时与通过 python 运行时显示不同的输出?

终端:

$ gdalinfo --version

GDAL 2.2.3,于 2017 年 11 月 20 日发布

Python:

import os
os.system('gdalinfo --version')

给 6

【问题讨论】:

    标签: python version gdal


    【解决方案1】:

    os.system 返回退出代码,根据您的操作系统,退出代码可能具有不同的含义。如果要显示系统调用的输出,例如使用:

    import subprocess
    subprocess.check_output('gdalinfo --version')
    

    【讨论】:

      猜你喜欢
      • 2019-06-05
      • 2017-03-20
      • 2013-07-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-01
      • 2020-12-07
      • 2021-06-14
      相关资源
      最近更新 更多