无法找到或加载 Qt 平台插件“xcb"; [英] Could not find or load the Qt platform plugin "xcb"

查看:219
本文介绍了无法找到或加载 Qt 平台插件“xcb";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的操作系统(Linux Mint Debian Edition 2)上,除了 apt 安装的系统 python(/usr/bin/python),我还安装了蟒蛇.但是我在使用 anaconda python

On my OS(Linux Mint Debian Edition 2), except for the system python(/usr/bin/python) installed by the apt, I also installed the anaconda. But I've encounterd a problem running the following code with the anaconda python

# test.py
import matplotlib.pyplot as plt
import numpy as np
x = np.array([0, 1])
plt.scatter(x, x)
plt.show()

错误是

此应用程序无法启动,因为它无法找到或加载Qt 平台插件xcb".

This application failed to start because it could not find or load the Qt platform plugin "xcb".

重新安装应用程序可能会解决此问题.

Reinstalling the application may fix this problem.

中止

但是如果我尝试使用系统python,即/usr/bin/python test.py,它可以正常工作.

But if I try with the system python, i.e., /usr/bin/python test.py, it works correctly.

然后我尝试了system和anaconda的ipython,结果和之前一样:anaconda ipython内核死了.

Then I tried the ipythons, of system and of anaconda, the result is same as before: the anaconda ipython kernel died.

我尝试将 ipython 魔术 %matplotlib inline 添加到代码中,anaconda ipython 现在可以正常工作.但是如果我用 %pylab 替换 %matplotlib inline,anaconda ipython 又死了.

And I tried add the ipython magic %matplotlib inline into the code, the anaconda ipython works correctly now. But if I replace the %matplotlib inline with %pylab, the anaconda ipython died again.

注意:我使用的是 python 2.7.System ipython的版本是2.3,anaconda ipython的版本是3.2.

Note: I use the python 2.7. System ipython's version is 2.3, anaconda ipython's version is 3.2.

推荐答案

Linux Mint 17, 64 位也有同样的问题.在网上搜索了4小时后解决了!您需要在终端上从文件夹/anaconda2/bin 发出这些命令

Same problem with Linux Mint 17, 64 bit. It was solved after 4h searching on the net! You need to give these commands on the terminal from folder /anaconda2/bin

sudo ./conda remove qt
sudo ./conda remove pyqt
sudo ./conda install qt
sudo ./conda install pyqt

希望对您有所帮助!

这篇关于无法找到或加载 Qt 平台插件“xcb";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆