Numpy、 Numeric的问题

77 views
Skip to first unread message

GeoSun

unread,
Apr 30, 2009, 1:54:24 PM4/30/09
to gdal+python+GIS+geosings论坛
初学gdal,安装gdal后,在python练习,用ReadAsArray时,总是“ImportError: No module named
Numeric” ,网上查资料后安装了numpy,\Lib\site-packages作为环境变量也设置了,可以import numpy,不过
上面的问题依然得不到解决,请指教

linux23...@gmail.com

unread,
Apr 30, 2009, 11:06:40 PM4/30/09
to gdal+python+GIS+geosings论坛
要安装的是Numeic的库。numpy不认

GeoSun

unread,
May 1, 2009, 12:59:21 AM5/1/09
to gdal+python+GIS+geosings论坛

On 5月1日, 上午11时06分, "linux23maill...@gmail.com"
<linux23maill...@gmail.com> wrote:
> 要安装的是Numeic的库。numpy不认
Numeric的库?不懂
>>> import Numeric

Traceback (innermost last):

File "<stdin>", line 1, in ?

ImportError: No module named Numeric

>>>

indicating that you don't have NumPy installed, or:

>>> import Numeric

>>>

indicating that you do. If you do, go on to the next step. If you
don't, you have to get the NumPy extensions.

这是从numpy网站文档摘录的,python 的numeric 不是numpy吗?这是我的理解,还有单独的numeric库? 请大侠指点。

GeoSun

unread,
May 1, 2009, 1:18:41 AM5/1/09
to gdal+python+GIS+geosings论坛
这是错误提示:
Traceback (most recent call last):
File "<pyshell#20>", line 1, in -toplevel-
dataset.ReadAsArray(100,100,50,50)
File "D:\PROGRA~1\ARCGIS\PYTHON24\lib\site-packages\gdal.py", line
746, in ReadAsArray
import gdalnumeric
File "D:\PROGRA~1\ARCGIS\PYTHON24\lib\site-packages\gdalnumeric.py",
line 88, in -toplevel-
from Numeric import *

linux23...@gmail.com

unread,
May 2, 2009, 10:40:11 AM5/2/09
to gdal+python+GIS+geosings论坛

GeoSun

unread,
May 2, 2009, 4:20:14 PM5/2/09
to gdal+python+GIS+geosings论坛
真是不好意思,昨天重装系统,装了python2.5,,装完gdal后,将Lib\site-packages与gdal/bin加入path,
import gdal 失败,ImportError: No module named _gdal,网上查了,基本都是说环境变量的问题,还
http://www.3snews.net/html/75/7575-18039.html 说的安装fwtool,没试,因为上次安装的
2.4,这一步是成功的,不知有什么好点的办法没,又拿这种问题打搅,再次抱歉!

linux23...@gmail.com

unread,
May 2, 2009, 11:20:44 PM5/2/09
to gdal+python+GIS+geosings论坛
把_gdal.dll改成_gdal.pyd

以后gdal自己编译吧,有好处!

On 5月3日, 上午4时20分, GeoSun <guochengx...@gmail.com> wrote:
> 真是不好意思,昨天重装系统,装了python2.5,,装完gdal后,将Lib\site-packages与gdal/bin加入path,
> import gdal 失败,ImportError: No module named _gdal,网上查了,基本都是说环境变量的问题,还

> 有 http://www.3snews.net/html/75/7575-18039.html说的安装fwtool,没试,因为上次安装的

GeoSun

unread,
May 3, 2009, 5:02:24 AM5/3/09
to gdal+python+GIS+geosings论坛
是 ,多谢了,是照查到的自己编译的,以前没接触过编译方面的东西,编译出来了也不知道怎么回事。
再次感谢!呵呵

GeoSun

unread,
May 3, 2009, 10:45:42 AM5/3/09
to gdal+python+GIS+geosings论坛
在您的gdal学习笔记中,有 colormap = band.GetRasterColorTable() 我在dir(colormap)
时,只显示['__class__', '__delattr__', '__doc__', '__getattribute__',
'__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__',
'__repr__', '__setattr__', '__str__'] 这几个选项,并没有其他GetCount等方法,我查了文档,
GetRasterColorTable返回的是ColorTableH ,如下,(GDALColorTableH
GDALGetRasterColorTable ( GDALRasterBandH hBand ) )。并且dir
(gdal.ColorTable)才有笔记中dir(colormap)的选项 :['Clone', 'GetColorEntry',
'GetColorEntryAsRGB', 'GetCount', 'GetPaletteInterpretation',
'SetColorEntry', '__del__', '__doc__', '__init__', '__module__',
'__str__', 'serialize']。而文档中band的方法中返回ColorTable的GetColorTable,在dir
(band)中并没有,请问这是怎么回事呢,谢谢

linux23...@gmail.com

unread,
May 3, 2009, 8:43:09 PM5/3/09
to gdal+python+GIS+geosings论坛
你那个可能是空,这个如果不是一个问题,不要放在同一个问题中讨论

On 5月3日, 下午10时45分, GeoSun <guochengx...@gmail.com> wrote:
> 在您的gdal学习笔记中,有 colormap = band.GetRasterColorTable() 我在dir(colormap)
> 时,只显示['__class__', '__delattr__', '__doc__', '__getattribute__',
> '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__',
> '__repr__', '__setattr__', '__str__'] 这几个选项,并没有其他GetCount等方法,我查了文档,

> GetRasterColorTable返回的 是ColorTableH ,如下,(GDALColorTableH

东东爸

unread,
Jul 1, 2009, 4:44:54 AM7/1/09
to gdal+python+GIS+geosings论坛
我也遇到一样的问题,用vs2008编译的,遇到点编码的小问题,改了后能编译成功。但在python中import gdal报错,说没有
module叫_gdal,也尝试把_gdal.dll改为_gdal.pyd,出现运行时错误,"An application has made
an attempt to load the C runtime library incorrectly. "

为什么我自己编译的也没生成_gdal.pyd文件?为什么将dll改为pyd会报错呢?


On May 3, 11:20 am, "linux23maill...@gmail.com"

linux23...@gmail.com

unread,
Jul 2, 2009, 6:40:02 AM7/2/09
to gdal+python+GIS+geosings论坛
2008可能比较有问题......主要是manifest清单问题。没有内嵌进去。

东东爸

unread,
Jul 2, 2009, 7:17:28 AM7/2/09
to geos...@googlegroups.com
现在已经解决了~后来下载了一个gdal的python绑定的安装版,安装后还是报错,不过把gdal16.dll拷贝到安装目录后就可以用了~

现在正在看GIS红宝书,学习使用GDAL~:)




--
Best Regards!

Ace Strong

==================================================
Nanjing University of Aeronautics and Astronautics.
College of Civil Aviation
Tao Cheng
E-mail: aces...@gmail.com ;aces...@nuaa.edu.cn
Tel: 86-025-84892273
==================================================
Reply all
Reply to author
Forward
0 new messages