You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu22.04下pythonOCC运行报错:缺失Qt平台插件wayland

PythonOCC 7.7.0可视化后端Wayland插件问题求助

在Ubuntu 22.04机器的Anaconda虚拟环境(Python3.9)中已成功安装PythonOCC 7.7.0版本。运行测试示例代码时,先出现无可视化后端相关报错,通过conda安装PySide2后,报错变为找不到Qt平台插件"wayland"。尝试安装wxpython、PyQt、qtwayland5并设置环境变量等方法均未解决问题,寻求可行解决方案。

测试代码

from OCC.Display.SimpleGui import init_display
from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeBox
display, start_display, add_menu, add_function_to_menu = init_display()
my_box = BRepPrimAPI_MakeBox(10., 20., 30.).Shape()
display.DisplayShape(my_box, update=True)
start_display()

报错信息

qt - pyside2 backend - Qt version ..
qt-qpa-plugin: Could not find the Qt platform plugin "wayland" in ""
###### 3D rendering pipe initialisation #####
Display3d class initialization starting ...
Aspect_DisplayConnection created.
OpenGL_GraphicDriver created.
V3d_Viewer created.
AIS_InteractiveContext created.
V3d View created

已尝试的解决命令

# wxpython
sudo apt update
sudo apt install libgtk-3-dev
sudo pip install wxpython
# pyqt
conda install pyqt
# qtwayland5
sudo apt install qtwayland5
export QT_QPA_PLATFORM=wayland

内容的提问来源于stack exchange,提问作者MrJ

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.16 06:15:05