C++打包好的exe文件:test.exe
使用python调用test.exe
import subprocess
# 定义text.ext中的参数,例如其中需要输入和输出路径
in_path = 'input.shp'
out_path = 'output.shp'
command = [
'test.exe',
'-inPath=' + in_path,
'-outPath=' + out_path,
]
# 执行命令
subprocess.run(command, capture_output=True, text=True)