在终端中执行 python 脚本或在 mac 中执行 pvpython

Execution python script in terminal or pvpython in mac

我安装了 ParaView 5.7 并用它录制了一个 python 脚本。 在 Windows 10 中,我可以打开 pvpython shell 并执行代码,但在我的 Mac 中我找不到这个 pvpython shell.

我尝试在终端中执行脚本 python my_script.py 并收到错误

from paraview.simple import *
ImportError: No module named paraview.simple

我的sys.path

'/Library/Python/2.7/site-packages/pip-19.3.1-py2.7.egg', 
'/Users/jane/Desktop', 
'/home/jane/Code/Kitware/build/VTK/lib/python2.7/site-packages', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', 
'/Library/Python/2.7/site-packages', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC'
]

我还应该在 PYTHONPATH 中添加什么?

在 Mac 上,pvpython 安装在 /Applications/ParaView-5.7.0.app/Contents/bin/pvpython

使用 conda 安装了 paraview

$ conda install -c conda-forge paraview 

这对我有用