Unable to compile QGIS 3.2 on xenial; Python3 erro

2019-05-29 10:15发布

When trying to compile the latest version of QGIS ( https://github.com/qgis/QGIS ) I end up with the folowing erros on 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

Here is my python3 --version:

Python 3.5.2

I installed PyQt5 and other Python3 packages through pip3 to have the latest (in /usr/local).

Here are all the qt related packages $ 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  

Installation instructions can be found here: https://github.com/qgis/QGIS/blob/master/INSTALL

My OS is Ubuntu 16.04; uname -mor:

4.15.0-29-generic x86_64 GNU/Linux

The same error message appears if I simply run a python3 console and try to import Qsci from PyQt5 for example:

>>> 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

For the first error, which is lightly different, it seems the same as: qgis ModuleNotFoundError: No module named 'PyQt5.pyqtconfig'

1条回答
在下西门庆
2楼-- · 2019-05-29 11:00

For the second error, the solution I found, it is changing python version from 3.5 to 3.6, The mention in this documentation PyQt should work with python3.5 but it still gives me the error ImportError: /usr/local/lib/python3.5/dist-packages/PyQt5/QtCore.so: undefined symbol: PySlice_AdjustIndices. So, try to run the code with python3.6

查看更多
登录 后发表回答