如何使用pvbatch或pv python运行paraview Python代码

时间:2015-04-28 08:19:37

标签: python paraview

我正在尝试使用pvpython [filename].py

运行此Python文件
from paraview.simple import *
servermanager.Connect()
#sphere = Sphere();
#Show();

import os
i = 0
SubDir = [" "]*30
# Set the directory you want to start from
rootDir = '/var/www/html/php/emd/job552e23fe74d102/VTK'
for dirName, subdirList, fileList in os.walk(rootDir):
    if dirName == rootDir + '/others':
       continue
    if dirName == rootDir:
       continue
    SubDir.append(dirName)
    i=i+1
    print('Found directory: %s' % dirName)
    for fname in fileList:
        print('\t%s' % fname)
        j=1
        j= LegacyVTKReader( FileNames=[dirName + '/' + fname] )

我收到此错误

File "paraview.py", line 2, in <module>
    from paraview.simple import *
File "/var/www/html/php/emd/job552e23fe74d102/VTK/paraview.py", line 2, in <module>
    from paraview.simple import *
ImportError: No module named simple

我有什么地方出错了。请帮助我,我是初学者。

1 个答案:

答案 0 :(得分:0)

如果我不将保存ParaView库的目录添加到LD_LIBRARY_PATH系统变量,则会发生这种情况。我安装了ParaView 4.0.1作为示例,我在Ubuntu中将该路径附加到变量中:

export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:/home/sgeadmin/ParaView-4.0.1-Linux-64bit/lib/paraview-4.0