无法找到或加载Qt平台插件"xcb", [英] Could not find or load the Qt platform plugin "xcb"
问题描述
在我的操作系统(Linux Mint Debian Edition 2)上,除了 apt 安装的系统python(/usr/bin/python )之外,我还安装了 anaconda .但是我在使用 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 magic %matplotlib inline
添加到代码中,anaconda ipython现在可以正常工作了.但是,如果我用%pylab
替换%matplotlib inline
,那蟒蛇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.系统ipython的版本为2.3,蟒蛇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屋!