加载netCDF时出错

时间:2013-01-17 03:51:00

标签: python

我打算在Ubuntu 11.10中使用需要python-scientific的python脚本。在脚本的开头有如下行:

from Scientific.IO.NetCDF import NetCDFFile as Dataset
import itertools as itx
.
.
.

我使用

安装了python-scientific
sudo apt-get install python-scientific

并且所有安装都顺利进行。 但是当我尝试运行脚本时,我收到如下错误消息

from: can't read /var/mail/Scientific.IO.NetCDF

我发现NetCDF.py代码位于以下路径:

/usr/lib/python2.7/dist-packages/Scientific/IO

我确信我使用的脚本没有问题,因为它可以在另一台机器上运行。 只是想知道为什么会出现这种错误以及如何解决这个问题。

感谢任何帮助。

此致

1 个答案:

答案 0 :(得分:1)

你是直接从bash运行脚本的不是吗?

尝试将#!/usr/bin/env python放在脚本的顶部。

如果没有那行(称为hashbang或shebang),shell不知道它应该使用Python来执行脚本,因此它会尝试执行脚本本身。 from是一个命令,用于打印出已向指定用户发送邮件的人 - 因此shell正在执行from Scientific.IO.NetCDF import NetCDFFile as Dataset,而from正在尝试读取已向所述用户发送邮件的用户“Scientific.IO.NetCDF”。不出所料,该用户不存在,因此您的错误消息。