概述
本文记录了PyQGIS环境搭建过程和遇到的问题
一、PyQGIS环境搭建
1.所需资源
- QGIS3.22安装包
- QT5
- Pycharm2019
2.环境搭建
(1)资源安装
QGIS3.22和QT5去官网下载安装即可,Pycharm自行找资源,下面是QGIS3.22安装的目录
(2)配置QGIS内置的Python的环境路径
先配置用户变量,路径为QGIS安装目录下的Python39的路径
再配置系统变量
添加PYTHONHOME和PYTHONPATH
(3)在Pycharm中配置QGIS的python解释器
(4)配置自定义pip命令防止影响全局pip
在这之前,Pycharm的项目中应该能正常的导入PyQGIS的包了,以下的操作详见:配置pyqgis+pycharm开发环境的步骤3。
二、遇到的问题
1.PyCharm如何设置鼠标悬停自动显示函数的快速文档(另附代码自动补全设置):https://blog.csdn.net/eee_Eileen/article/details/104265563
2.Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding:https://blog.csdn.net/vxwxv/article/details/126123585
三、PyQGIS教程
1.pyqgis官方文档:https://docs.qgis.org/3.16/en/docs/pyqgis_developer_cookbook/loadlayer.html#qgsproject-instance
2.pyqgis中文文档:https://luolingchun.github.io/PyQGIS-Developer-Cookbook-cn/
3.https://blog.csdn.net/this_is_id/article/details/105238944
4.https://blog.csdn.net/this_is_id/category_9290488.html
5.https://blog.csdn.net/l_andy/category_9016281.html
6.pyqgis官方API:https://qgis.org/pyqgis/3.22/
四、PyQGIS和PyQT速查
1.pyqgis 加载栅格图层:https://blog.csdn.net/mrbaolong/article/details/107708676
2.ui转py:https://blog.csdn.net/chinababy2021/article/details/118442111
3.PyQt5右键启动菜单:https://blog.csdn.net/u013934107/article/details/92634970
4.Qt dockwidget 标题栏去掉关闭按钮,自定义双击操作:https://blog.csdn.net/perceptive558/article/details/122729543
5.pyqt5在图像上绘制矩形框:https://blog.csdn.net/guoqingru0311/article/details/123594557
6.PyQt5绘制图形(圆、矩形、斜矩形):https://blog.csdn.net/this_is_id/article/details/123050230
7.【解决问题】TypeError: getOpenFileName(parent: QWidget = None, caption: str = ‘’:https://blog.csdn.net/qq_43145926/article/details/104518199
8.QGIS默认事件汉化:https://github.com/luolingchun/PyQGIS/blob/master/PyQGIS.py#L31
9.Qt添加菜单栏和工具栏:https://blog.csdn.net/weixin_39510813/article/details/83348528
10.QGis二次开发基础 – 添加矢量要素功能:https://blog.csdn.net/L_Andy/article/details/109407731