以前它在较低版本的 qgis 中可以正常工作。更新到较新版本后,它就无法正常工作了。
由于调用 classFactory() 方法时出错,无法加载插件“dzetsaka”
AttributeError: module 'pip' has no attribute 'main'
Traceback (most recent call last):
File "C:/Users/VVSK/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\dzetsaka\dzetsaka.py", line 54, in
from sklearn import datasets
File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 672, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'sklearn'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 335, in startPlugin
plugins[packageName] = package.classFactory(iface)
File "C:/Users/VVSK/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\dzetsaka\__init__.py", line 35, in classFactory
from .dzetsaka import dzetsakaGUI
File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 672, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "C:/Users/VVSK/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\dzetsaka\dzetsaka.py", line 56, in
pip.main(['install','-U' , 'scikit-learn'])
AttributeError: module 'pip' has no attribute 'main'
Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
QGIS version: 3.4.2-Madeira Madeira, 22034aa070
Python Path:
C:/Users/VVSK/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\leastcostpath
C:/OSGEO4~1/apps/qgis/./python
C:/Users/VVSK/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/VVSK/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
C:/OSGEO4~1/apps/qgis/./python/plugins
C:\OSGeo4W64\bin\python37.zip
C:\OSGEO4~1\apps\Python37\DLLs
C:\OSGEO4~1\apps\Python37\lib
C:\OSGeo4W64\bin
C:\OSGEO4~1\apps\Python37
C:\OSGEO4~1\apps\Python37\lib\site-packages
C:\OSGEO4~1\apps\Python37\lib\site-packages\win32
C:\OSGEO4~1\apps\Python37\lib\site-packages\win32\lib
C:\OSGEO4~1\apps\Python37\lib\site-packages\Pythonwin
C:/Users/VVSK/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/VVSK/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\go2streetview
C:\Users\VVSK\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\go2streetview\res
C:\Users\VVSK\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins
.
C:\Users\VVSK\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\tuflow
C:\Users\VVSK\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\tuflow/forms
C:\Users\VVSK\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\tuflow
C:\Users\VVSK\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\tuflow/forms
C:\Users\VVSK\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\tuflow/forms
C:/Users/VVSK/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\timeseriesviewerplugin
C:\Users\VVSK\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\timeseriesviewerplugin\site-packages
答案1
我是 Nicolas,dzetsaka 的开发者。
抱歉,这个错误,我刚刚在 12 月进行了更新,以自动安装 sklearn(该库曾经有 Random-Forest、KNN 和 SVM 等算法)。事实上,在某些情况下它不起作用,所以我现在就进行更新,以防止在安装 sklearn 时出现错误(从而无法安装这个很棒的库)。
但是如果您想使用 RF 或 SVM 算法,请阅读此处的操作方法:https://github.com/lennepkade/dzetsaka。
我已将 dzetsaka V3.4.2 提交给 Qgis,因此它应该很快就会在 Qgis 3 中可用。
下次如果您遇到错误,请在此处留言:https://github.com/lennepkade/dzetsaka/issues