简体   繁体   English

ubuntu18.04上的pyside2安装问题,anaconda上的python 3.8.3

[英]pyside2 installation problem on ubuntu18.04, python 3.8.3 on anaconda

After installing anaconda3, I began to install pyside2.安装anaconda3后,我开始安装pyside2。

I directly typed pip install pyside2 , and successfully installed pyside2 5.15.我直接输入pip install pyside2 ,成功安装 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.我什么时候到/usr/lib/x86_64-linux-gnu并找到了libgssapi_krb5.so.2libkrb5.so.3 ,我不知道如何修复这个错误。 Can anybody help me?有谁能够帮我?

My environment:我的环境:

python: 3.8.3 python:3.8.3

OS: ubuntu 18.04操作系统:ubuntu 18.04

CPU: AMD ryzen 3600 CPU:AMD锐龙3600

You are getting the error because you have a wrong version of qt on your machine.您收到错误是因为您的机器上的 qt 版本错误。 I mean it seems anaconda installs the wrong version of QT by default.我的意思是 anaconda 默认安装了错误的 QT 版本。 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 pip uninstall pyside2, qt, pyqt5如果您已使用pip安装它们
  2. conda remove pyside2, qt, pyqt5 if you have installed them with conda conda remove pyside2, qt, pyqt5如果你已经用conda安装了它们
  3. conda install -c conda-forge pyside2

I had a similar issue, though I was not using anaconda.我有一个类似的问题,虽然我没有使用 anaconda。 The error appears to be a krb5 version mismatch between PySide2 and Ubuntu packages.该错误似乎是 PySide2 和 Ubuntu 包之间的krb5版本不匹配。 I was able to resolve the issue by compiling krb5 from source and adding the lib directory to LD_LIBRARY_PATH.我能够通过从源代码编译 krb5 并将 lib 目录添加到 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. python 导入不再引发错误。 I found this worked with several different krb5 versions from the offical website;我发现这适用于官方网站上的几个不同的 krb5 版本; the error seems to be in the Ubuntu modifcations to the package.该错误似乎出现在对 package 的 Ubuntu 修改中。

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.正如其他答案所建议的,您可能已成功卸载并重新安装 Python Qt 绑定,但这对我不起作用。

Just build in the pyside2 dependencies .只需构建 pyside2依赖项。 if you wanna to use your virtual environment.如果你想使用你的虚拟环境。

End build the Clang Library结束构建Clang 库

I am sorry, your answer above seems correct except for the presence of opencv, which is not in the original question.对不起,您上面的答案似乎是正确的,除了 opencv 的存在,这不在原始问题中。 Opencv in my opinion has nothing to do with pyside2 or the question.我认为 Opencv 与 pyside2 或问题无关。 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM