无法获取Python IDLE来识别OGR/GDAL模块 [英] Can't get Python IDLE to recognize OGR/GDAL Module

查看:184
本文介绍了无法获取Python IDLE来识别OGR/GDAL模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计,

刚开始使用OGR和Python进行各种地理空间任务.我在OSGEO4w之外工作,并在计算机上安装了带Python绑定的GDAL以及Python v.2.7.8.

Just getting started using OGR and Python for a variety of geospatial tasks. I'm working outside of OSGEO4w, and have installed GDAL w/ Python Bindings as well as Python v. 2.7.8 on my machine.

也就是说,我可以从命令行界面运行python并导入gdal,但是在使用IDLE环境时无法导入模块.它返回一个错误,告诉我该模块不存在.鉴于它可以在cmd提示符下运行,因此我的安装必须正确无误,这有什么用?

That said, I can run python and import gdal from a command-line interface but am unable to import the module when I use the IDLE environment. It returns an error telling me that the module doesn't exist. My install must be sound given that it works in the cmd prompt, so what's the deal?

这对我来说是全新的,我会感激您可以提供的任何帮助或建议;我以前阅读的所有问题都与仅安装(我已经成功完成)并让Python从命令提示符下识别模块有关.

This is all new to me, I'd appreciate any help or advice ya'll can impart; all previous questions I've read were concerned w/ merely installing (which I've done successfully) and getting Python to recognize the module from the command prompt, which it does.

干杯

迈克

推荐答案

麦克,

您可以通过cmd行通过python安装打开IDLE:

You can open IDLE with your python installation from the cmd line through:

>>>from idlelib import PyShell  
>>>PyShell.main()

这应该从您当前的python打开IDLE,然后您应该能够从那里导入gdal和ogr.

This should open IDLE from your current python, and you should be able then to import gdal and ogr from there.

或者,您应该在此处有一个Windows批处理文件 C:\ YOURPYTHONPATH \ Lib \ idlelib \ idle.bat

Alternatively, you should have a windows batch file here C:\YOURPYTHONPATH\Lib\idlelib\idle.bat

运行此命令应该可以达到相同的效果.

Running this should achieve the same.

马丁

这篇关于无法获取Python IDLE来识别OGR/GDAL模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆