QGIS 3插件无法检测python软件包

时间:2019-03-06 13:01:52

标签: python python-3.x qgis

我已经安装了通过插件构建器3创建的自定义插件。我刚刚添加了 const uint WM_NCHITTEST = 0x0084, WM_MOUSEMOVE = 0x0200, HTLEFT = 10, HTRIGHT = 11, HTBOTTOMRIGHT = 17, HTBOTTOM = 15, HTBOTTOMLEFT = 16, HTTOP = 12, HTTOPLEFT = 13, HTTOPRIGHT = 14; Size formSize; Point screenPoint; Point clientPoint; Dictionary<uint, Rectangle> boxes; const int RHS = 10; // RESIZE_HANDLE_SIZE bool handled; protected override void WndProc(ref Message m) { if (this.WindowState == FormWindowState.Maximized) { base.WndProc(ref m); return; } handled = false; if (m.Msg == WM_NCHITTEST || m.Msg == WM_MOUSEMOVE) { formSize = this.Size; screenPoint = new Point(m.LParam.ToInt32()); clientPoint = this.PointToClient(screenPoint); boxes = new Dictionary<uint, Rectangle>() { {HTBOTTOMLEFT, new Rectangle(0, formSize.Height - RHS, RHS, RHS)}, {HTBOTTOM, new Rectangle(RHS, formSize.Height - RHS, formSize.Width - 2*RHS, RHS)}, {HTBOTTOMRIGHT, new Rectangle(formSize.Width - RHS, formSize.Height - RHS, RHS, RHS)}, {HTRIGHT, new Rectangle(formSize.Width - RHS, RHS, RHS, formSize.Height - 2*RHS)}, {HTTOPRIGHT, new Rectangle(formSize.Width - RHS, 0, RHS, RHS) }, {HTTOP, new Rectangle(RHS, 0, formSize.Width - 2*RHS, RHS) }, {HTTOPLEFT, new Rectangle(0, 0, RHS, RHS) }, {HTLEFT, new Rectangle(0, RHS, RHS, formSize.Height - 2*RHS) } }; foreach (var hitBox in boxes) { if (hitBox.Value.Contains(clientPoint)) { m.Result = (IntPtr)hitBox.Key; handled = true; break; } } } if (!handled) base.WndProc(ref m); } 语句,并将该插件部署到了QGIS。这给了堆栈跟踪以下错误。

  

ModuleNotFoundError:没有名为'pymongo'的模块

import pymango

pymango python库安装在Traceback (most recent call last): File "/usr/lib/python3/dist-packages/qgis/utils.py", line 335, in startPlugin plugins[packageName] = package.classFactory(iface) File "/home/ubuntu/.local/share/QGIS/QGIS3/profiles/default/python/plugins/sample/__init__.py", line 35, in classFactory from .sample import custom_plugin File "/usr/lib/python3/dist-packages/qgis/utils.py", line 672, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/home/ubuntu/.local/share/QGIS/QGIS3/profiles/default/python/plugins/sample/custom_plugin.py", line 33, in import pymongo File "/usr/lib/python3/dist-packages/qgis/utils.py", line 672, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ModuleNotFoundError: No module named 'pymongo' Python Path: /usr/share/qgis/python /home/ubuntu/.local/share/QGIS/QGIS3/profiles/default/python /home/ubuntu/.local/share/QGIS/QGIS3/profiles/default/python/plugins /usr/share/qgis/python/plugins /usr/lib/python36.zip /usr/lib/python3.6 /usr/lib/python3.6/lib-dynload /home/ubuntu/.local/lib/python3.6/site-packages /usr/local/lib/python3.6/dist-packages /usr/lib/python3/dist-packages /home/ubuntu/.local/share/QGIS/QGIS3/profiles/default/python 文件夹中。您可以在python路径中看到此文件夹,但QGIS3.6桌面应用程序仍无法找到该软件包。有解决办法吗?

系统详细信息:

Python版本:3.6.7(默认值,2018年10月22日,11:32:17)[GCC 8.2.0]

QGIS版本:3.6.0-Noosa Noosa,5873452

Ubuntu:18.04

0 个答案:

没有答案