pyside2 installation problem on ubuntu18.04, python 3.8.3 on anaconda

耗尽温柔 提交于 2021-01-20 07:56:40

问题


After installing anaconda3, I began to install pyside2.

I directly typed pip install pyside2, and successfully installed pyside2 5.15. But when I ran the toy example, an error occurred:

Traceback (most recent call last):
  File "test.py", line 2, in <module>
    from PySide2.QtWidgets import QApplication, QLabel
ImportError: /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2: symbol krb5_ser_context_init version krb5_3_MIT not defined in file libkrb5.so.3 with link time reference

I when to /usr/lib/x86_64-linux-gnu and found both libgssapi_krb5.so.2 and libkrb5.so.3, and I have no idea how to fix this bug. Can anybody help me?

My environment:

python: 3.8.3

OS: ubuntu 18.04

CPU: AMD ryzen 3600


回答1:


You are getting the error because you have a wrong version of qt on your machine. I mean it seems anaconda installs the wrong version of QT by default. First, you need to install essential packages (enter link description here) and then do the following steps:

  1. pip uninstall pyside2, qt, pyqt5 if you have installed them with pip
  2. conda remove pyside2, qt, pyqt5 if you have installed them with conda
  3. conda install -c conda-forge pyside2



回答2:


I had a similar issue, though I was not using anaconda. The error appears to be a krb5 version mismatch between PySide2 and Ubuntu packages. I was able to resolve the issue by compiling krb5 from source and adding the lib directory to LD_LIBRARY_PATH.

tar xf krb5-1.18.2.tar.gz
cd krb5-1.18.2/src
./configure --prefix=/opt/krb5/
make && make install

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/krb5/lib
python -c "import PySide2.QtCore"

The python import no longer raised an error. I found this worked with several different krb5 versions from the offical website; the error seems to be in the Ubuntu modifcations to the package.

You may have success with uninstalling and reinstalling the Python Qt bindings, as suggested by the other answers, but this did not work for me.




回答3:


I am sorry, your answer above seems correct except for the presence of opencv, which is not in the original question. Opencv in my opinion has nothing to do with pyside2 or the question. So, the correct procedure in my opinion would be:

 1. pip uninstall pyside2, qt, pyqt5 if you have installed them with pip
 2. conda remove pyside2, qt, pyqt5 if you have installed them with conda
 3. conda install -c conda-forge pyside2


来源:https://stackoverflow.com/questions/63186438/pyside2-installation-problem-on-ubuntu18-04-python-3-8-3-on-anaconda

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!