是QgsMapLayerRegistry
要在与QGIS3 pyqgis速效
当我在QGIS python控制台(2.99)中键入它时,python似乎可以识别它,因为它会自动完成qgis.core.QgsMapLayerRegistry
,但是会出现一个错误,提示它不存在:
Traceback (most recent call last):
File "/usr/lib/python3.5/code.py", line 91, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
AttributeError: module 'qgis.core' has no attribute 'QgsMapLayerRegistry'
我用两个版本的QGIS 2.99进行了尝试(一个版本是01/07,然后是06/17)。两个版本给出相同的错误。import
也不起作用:
>>>from qgis.core import QgsMapLayerRegistry
Traceback (most recent call last):
File "/usr/lib/python3.5/code.py", line 91, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
ImportError: cannot import name 'QgsMapLayerRegistry'
QgsMapLayerRegistry
在QGIS3中被删除了吗?