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

QGIS深度学习训练数据插件报pyrsgis.raster无createDS属性如何解决

问题原因分析

报错AttributeError: module 'pyrsgis.raster' has no attribute 'createDS'是因为pyrsgis库版本不兼容导致的:0.4.x及以上版本的pyrsgis将原createDS方法重构更名,而你使用的Produce Training Data For Deep Learning插件仍适配旧版pyrsgis接口,该问题和GDAL库本身无直接关联,无需优先重装GDAL。

可选解决路径

路径1:降级pyrsgis库版本(优先推荐,无需修改插件代码)

  • 打开QGIS内置的Python环境终端,或者定位到QGIS对应的Python可执行文件路径
  • 执行命令卸载现有高版本pyrsgis:pip uninstall pyrsgis -y
  • 执行命令安装适配旧接口的0.3.9版本:pip install pyrsgis==0.3.9
  • 重启QGIS后重新运行插件即可

路径2:修改插件源码适配新版pyrsgis

不想调整pyrsgis版本的可以选择该方案:

  • 找到QGIS插件安装目录,默认路径参考:
    • Windows:C:\Users\你的用户名\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\produce_training_data_for_deep_learning
    • macOS:~/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/produce_training_data_for_deep_learning
    • Linux:~/.local/share/QGIS/QGIS3/profiles/default/python/plugins/produce_training_data_for_deep_learning
  • 全局搜索目录下的.py文件,定位调用createDS的代码行
  • 将原有调用代码pyrsgis.raster.createDS(参数列表)替换为新版接口pyrsgis.raster.create_raster(参数列表),新旧版本该方法的参数顺序、必填项完全一致,无需调整参数
  • 保存修改后重启QGIS即可生效
注意事项

仅当以上两种方案都执行后仍报GDAL相关报错时,再考虑重装匹配当前QGIS版本的GDAL库。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.09.23 21:54:01