paraview.simple Namesspace in IDE (e.g. Pycharm)

准备工作:

1. use the same python version as paraview binary was built with. (or build paraview from source using the system python)
2. Set PYTHONPATH to point to a list of directories where paraview stores its python files
3. Set LD_LIBRARY_PATH (on Unix or equivalent on other platforms) to point to where paraview stores its DLLs.

After that you can run paraview scripts using the system python and probably with pycharm (if pycharm uses the system python).

 

目前测试用paraview 5.8.1和Anaconda3,python版本都是3.7.4,但是会产生错误:

#osp: INITIALIZATION ERROR --> could not open module lib ospray_module_ispc: �Ҳ���ָ����ģ�顣

官方论坛说paraview 5.9版本会解决。

 

参考资料:

https://discourse.paraview.org/t/could-not-open-module-lib-ospray-module-ispc/4079/7

 

2021.02.06 更新:

目前可以在Pycharm中使用ParaView 5.9,上面的报错官方也已经解决。

准备工作:

1.统一ParaView和系统的Python版本,ParaView 5.9用的是Python 3.8,因此系统的python版本也需安装Python 3.8,建议使用Anaconda安装。

2.配置ParaView相关环境变量

(1)在Path里加入D:\Program Files\ParaView 5.9.0-MPI-Windows-Python3.8-msvc2017-64bit\bin

(2)新创建一个PYTHONPATH的变量,并加入D:\Program Files\ParaView 5.9.0-MPI-Windows-Python3.8-msvc2017-64bit\bin\Lib;D:\Program Files\ParaView 5.9.0-MPI-Windows-Python3.8-msvc2017-64bit\bin\Lib\site-packages;D:\Program Files\ParaView 5.9.0-MPI-Windows-Python3.8-msvc2017-64bit\bin\Lib\site-packages\paraview

测试环境为:

1.系统:win 10专业版

2.IDE:PyCharm Community Edition 2019.3.1 x64

3.测试代码

# 通过Python使用paraview需要加入这个模块
from paraview.simple import *

# 创建一个球体
sphere = Sphere()

# 准备显示球体
Show()

# 渲染
Render()

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

_黄岛主_

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值