Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 2.7 错误:';ogr2ogr';在python脚本中运行ogr2ogr时,不会将其识别为内部或外部命令、可操作程序或批处理文件_Python 2.7_Subprocess - Fatal编程技术网

Python 2.7 错误:';ogr2ogr';在python脚本中运行ogr2ogr时,不会将其识别为内部或外部命令、可操作程序或批处理文件

Python 2.7 错误:';ogr2ogr';在python脚本中运行ogr2ogr时,不会将其识别为内部或外部命令、可操作程序或批处理文件,python-2.7,subprocess,Python 2.7,Subprocess,我在尝试通过子进程运行ogr2ogr时出错,但我可以仅使用windows命令提示符运行它。该脚本将是一系列过程的一部分,这些过程从批量导入gpx文件到postgres db开始。谁能告诉我怎么了?谢谢 ::::::::::::: 运行此脚本时出现错误:“ogr2ogr”未被识别为内部或外部命令、可操作程序或批处理文件 导入子流程 导入系统 打印系统可执行文件 track=“20131007.gpx” 子进程调用([“ogr2ogr”、“-f”、“PostgreSQL”、“PG:dbname=TT

我在尝试通过子进程运行ogr2ogr时出错,但我可以仅使用windows命令提示符运行它。该脚本将是一系列过程的一部分,这些过程从批量导入gpx文件到postgres db开始。谁能告诉我怎么了?谢谢

::::::::::::: 运行此脚本时出现错误:“ogr2ogr”未被识别为内部或外部命令、可操作程序或批处理文件

导入子流程

导入系统

打印系统可执行文件

track=“20131007.gpx”

子进程调用([“ogr2ogr”、“-f”、“PostgreSQL”、“PG:dbname=TTBASEMain主机=localhost端口=5432用户=postgres密码=minda”,track],shell=True)

:::::::::::::: 这段代码做得很好

ogr2ogr-f PostgreSQL PG:“dbname='TTBASEMain'host='localhost'port='5432'user='postgres'password='minda'”20131007.gpx”

:::::::::::::: 这是我的环境路径中的内容:

C:\Users\User>path PATH=C:\Program Files(x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS客户端\;C:\ProgramFiles(x86)\NVIDIA Corporation\PhysX\Common;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\ProgramFiles(x86)\Intel\OpenCLSDK\3.0\bin\x86;C:\ProgramFiles(x86)\Intel\OpenCLSDK\3.0\bin\x64;C:\Program Files\Intel\Intel(R)管理引擎组件\DAL;C:\Program Files\Intel\Intel(R)管理引擎组件\IPT;C:\Program Files(x86)\Intel\Intel(R)管理引擎组件\DAL;C:\Program Files(x86)\Intel\Intel(R)管理引擎C 组件\IPT;C:\Program Files\Lenovo\Bluetooth软件\;C:\Program Files\Lenovo\Bluetooth Software\syswow64;C:\lastools\bin;C:\Python27;C:\Python27\脚本;C:\Python27\DLLs;C:\Python27\Lib\site包;C:\Users\User\AppData\Roaming.local\bin;C:\ProgramFiles(x86)\Windows工具包\8.1\Windows性能工具包\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\ProgramFiles\GDAL


重新安装python绑定解决了我的问题。我在下面的路径上看不到GDAL,但它现在正在工作。它应该在那里吗?既然没有,我将来可能会有另一轮的GDAL搔头

:::::::::::::: 这是我当前在python上键入sys.path时所拥有的:

Microsoft Windows[版本6.2.9200] (c) 2012年微软公司。版权所有

C:\Users\User>python win32上的Python 2.7.8(默认值,2014年6月30日,16:08:48)[MSC v.1500 64位(AMD64)] 有关详细信息,请键入“帮助”、“版权”、“信用证”或“许可证”

导入系统 搜索路径 ['',C:\windows\SYSTEM32\python27.zip',C:\python27\dll',C:\python27\lib',C:\python27 \lib\plat win',C:\Python27\lib\lib tk',C:\Python27',C:\Python27\lib\site packages',' C:\Python27\lib\site packages\wx-3.0-msw']

但是Python的
%PATH%
中有什么呢?