无法在Xenial上编译QGIS 3.2; PyQt5中的Python3错误(未定义符号:PySlice_AdjustIndices)

时间:2018-07-23 12:20:21

标签: compilation qgis

当尝试编译最新版本的QGIS(https://github.com/qgis/QGIS)时,我最终在cmake-gui上遇到以下错误:

Traceback (most recent call last):
  File "/opt/QGIS/cmake/FindPyQt5.py", line 34, in <module>
    import PyQt5.pyqtconfig
ImportError: No module named 'PyQt5.pyqtconfig'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/QGIS/cmake/FindPyQt5.py", line 37, in <module>
    import PyQt5.QtCore
ImportError: /usr/local/lib/python3.5/dist-packages/PyQt5/QtCore.so: undefined symbol: PySlice_AdjustIndices

Found SIP version: 4.17
Traceback (most recent call last):
  File "/opt/QGIS/cmake/FindQsci.py", line 45, in <module>
    from PyQt5.Qsci import QSCINTILLA_VERSION_STR
ImportError: /usr/local/lib/python3.5/dist-packages/PyQt5/QtCore.so: undefined symbol: PySlice_AdjustIndices

这是我的python3 --version

Python 3.5.2

我通过pip3安装了PyQt5和其他Python3软件包,以获取最新版本(在/ usr / local中)。

所有与qt相关的软件包$ pip3 list | grep -i qt

PyQt5                         5.11.2                
PyQt5-sip                     4.19.12               
PyQtChart                     5.11.2                
QtAwesome                     0.4.4                 
qtconsole                     4.3.1                 
QtPy                          1.3.1  

安装说明可以在这里找到: https://github.com/qgis/QGIS/blob/master/INSTALL

我的操作系统是Ubuntu 16.04; uname -mor

4.15.0-29-generic x86_64 GNU/Linux

例如,如果我只是运行python3控制台并尝试从PyQt5导入Qsci,则会出现相同的错误消息:

>>> from PyQt5 import Qsci
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /usr/local/lib/python3.5/dist-packages/PyQt5/QtCore.so: undefined symbol: PySlice_AdjustIndices

对于第一个错误(略有不同),它看起来与以下内容相同:qgis ModuleNotFoundError: No module named 'PyQt5.pyqtconfig'

1 个答案:

答案 0 :(得分:0)

对于第二个错误,我找到的解决方案是将python版本从3.5更改为3.6,此documentation PyQt中的提及应与python3.5一起使用,但仍给我错误{{1} }。 因此,尝试使用python3.6运行代码