通过conda为caffe模型安装PyQt4

时间:2016-10-15 15:43:29

标签: pyqt4 anaconda caffe

当我尝试从此处运行SEC caffe模型时:https://github.com/kolesman/SEC

我发生了错误:ImportError:没有名为PyQt4的模块

Caused by: java.lang.Error: Cannot load com.apple.laf.AquaLookAndFeel
    at javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1351)
    at javax.swing.UIManager.initialize(UIManager.java:1459)
    at javax.swing.UIManager.maybeInitialize(UIManager.java:1426)
    at javax.swing.UIManager.getDefaults(UIManager.java:659)
    at javax.swing.JComponent.setUI(JComponent.java:662)
    at org.jgraph.JGraph.setUI(JGraph.java:792)
    at org.jgraph.JGraph.updateUI(JGraph.java:806)
    at org.jgraph.JGraph.<init>(JGraph.java:767)
    at org.jgraph.JGraph.<init>(JGraph.java:721)
    at org.jgraph.JGraph.<init>(JGraph.java:697)
    at org.processmining.plugins.declareminer.visualizing.DGraph.<init>(DGraph.java:35)
    at org.processmining.plugins.declareminer.visualizing.ModelView.<init>(ModelView.java:37)
    at org.processmining.plugins.declareminer.visualizing.AssignmentModelView.<init>(AssignmentModelView.java:43)
    at ee.ut.deviance.preprocessing.DeclareDevianceModelGenerator.generateModel(DeclareDevianceModelGenerator.java:405)
    at ee.ut.cs.rum.declare.deviance.miner.plugin.v2.factory.RumPluginWorkerImpl.runWork(RumPluginWorkerImpl.java:177)
    at ee.ut.cs.rum.declare.deviance.miner.plugin.v2.Activator.start(Activator.java:25)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)

In this stackoverflow thread他们只是提到你可以运行

python demo.py --model SEC.caffemodel --image /data/out/dataset/center/1475186965759787059.jpg --smooth --output result.png
Traceback (most recent call last):
  File "demo.py", line 2, in <module>
    import pylab
  File "/home/ec2-user/anaconda2/lib/python2.7/site-packages/pylab.py", line 1, in <module>
    from matplotlib.pylab import *
  File "/home/ec2-user/anaconda2/lib/python2.7/site-packages/matplotlib/pylab.py", line 274, in <module>
    from matplotlib.pyplot import *
  File "/home/ec2-user/anaconda2/lib/python2.7/site-packages/matplotlib/pyplot.py", line 114, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/home/ec2-user/anaconda2/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "/home/ec2-user/anaconda2/lib/python2.7/site-packages/matplotlib/backends/backend_qt5agg.py", line 16, in <module>
    from .backend_qt5 import QtCore
  File "/home/ec2-user/anaconda2/lib/python2.7/site-packages/matplotlib/backends/backend_qt5.py", line 31, in <module>
    from .qt_compat import QtCore, QtGui, QtWidgets, _getSaveFileName, __version__
  File "/home/ec2-user/anaconda2/lib/python2.7/site-packages/matplotlib/backends/qt_compat.py", line 137, in <module>
    from PyQt4 import QtCore, QtGui
ImportError: No module named PyQt4

导致以下输出:

conda install pyqt

这表明我的版本是5.6而不是版本4.但我找不到任何解决方法如何降级到pyqt4。

2 个答案:

答案 0 :(得分:2)

所以你可以卸载pyqt5并下载PyQt4并手动安装 第二个选项是修改代码并用pyqt5替换PyQt4只需要注意pyqt5中的类是相同但激怒有点不同所以你可能得到的特定模型在这种情况下不存在检查手册pyqt5并修复它 我希望我的回答很清楚

答案 1 :(得分:2)

看起来最新版本的anaconda强制安装pyqt5.6而不是任何pyqt构建,这对你的应用程序来说是致命的。在终端中,尝试:

conda install --channel https://conda.anaconda.org/conda-forge pyqt
conda install -c anaconda pyqt=4.11.4

它会提示降级conda客户端。在那之后,它应该是好的。