QGIS 3.16.6:无法加载 SIP 模块

问题描述

在Windows 10上,QGIS 3.16启动过程中,经常遇到python的问题:

Couldn't load SIP module.
Python support will be disabled.

Traceback (most recent call last):
File "",line 1,in
File "C:/PROGRA1/QGIS31.16/apps/qgis-ltr/./python\qgis_init_.py",line 70,in
from qgis.PyQt import QtCore
File "C:/PROGRA1/QGIS31.16/apps/qgis-ltr/./python\qgis\PyQt\QtCore.py",line 24,in
from PyQt5.QtCore import *
ImportError: DLL load Failed: The specified procedure Could not be found.

我在以前版本的 QGIS 中遇到过这个问题,并且能够通过安装最新的 QGIS 版本来摆脱它,但过了一段时间后,这个错误又回来了。如果出现此问题,则 QGIS 不会加载地理处理工具并且几乎无法使用。

解决方法

如果你也是 anaconda 用户,这个问题的根源可能来自这里,当 anaconda 更新 python 包时。 在我的情况下,我能够通过删除这些文件夹来解决问题:

C:\Users\%USERNAME%\AppData\Roaming\QGIS
C:\Users\%USERNAME%\AppData\Roaming\Python

参考:https://github.com/qgis/QGIS/issues/31367