如何在VIM中执行Python代码时抑制警告

如何在VIM中执行Python代码时抑制警告,python,linux,unix,editor,vi,Python,Linux,Unix,Editor,Vi,从comman行运行代码时,我没有问题: $ python mycode.py > output.txt 但在VI编辑器中运行这些代码会引起警告: :! python mycod.py > output.txt /opt6/tools/python2.6.2/lib/python2.6/site-packages/numpy/oldnumeric/__init__.py:11: ModuleDeprecationWarning: The oldnumeric module will

从comman行运行代码时,我没有问题:

$ python mycode.py > output.txt
但在VI编辑器中运行这些代码会引起警告:

:! python mycod.py > output.txt
/opt6/tools/python2.6.2/lib/python2.6/site-packages/numpy/oldnumeric/__init__.py:11: ModuleDeprecationWarning: The oldnumeric module will be dropped in Numpy 1.9
  warnings.warn(_msg, ModuleDeprecationWarning)

为什么会这样?如何从VI禁用?

使用seterr管理numpy警告:


python-W ignore mycode.py>output.txt,但这是一个重复的问题,可能是Strange的重复。即使在控制台上运行python,也应该产生警告。您确定运行的是相同的python版本吗?如果我没有弄错的话,从python 2.7开始,默认情况下会忽略弃用警告。