我用python3安装caffe,但是当我导入caffe时,我得到了一些错误Traceback(最近一次调用最后一次):
Run Code Online (Sandbox Code Playgroud)File "classify.py", line 14, in <module> import caffe File "/home/hez/caffe-master/python/caffe/__init__.py", line 1, in <module> from .pycaffe import Net, SGDSolver File "/home/hez/caffe-master/python/caffe/pycaffe.py", line 13, in <module> from ._caffe import Net, SGDSolver ImportError: dynamic module does not define module export function (PyInit__caffe)
但它在python2.7中运行良好.
我已经将/ path/to/caffe/distrubute/python添加到PATH,但是当我创建pycaffe时,它显示了
make: Nothing to be done for `pycaffe'.
Run Code Online (Sandbox Code Playgroud)
我怎么解决这个问题?非常感谢你.
我尝试在PyQt5和Python3.5中使用mouseMoveEvent和mousePressEvent,但是当我单击鼠标时没有任何内容.我的代码如下,有什么问题吗?
from PyQt5 import QtWidgets, QtGui, QtCore
class Window(QtWidgets.QMainWindow):
def __init__(self):
QtWidgets.QMainWindow.__init__(self)
widget = QtWidgets.QWidget(self)
layout = QtWidgets.QVBoxLayout(widget)
self.graphicsView = QtWidgets.QGraphicsView()
self.graphicsView.setCursor(QtCore.Qt.CrossCursor)
self.graphicsView.setObjectName("graphicsView")
layout.addWidget(self.graphicsView)
self.setCentralWidget(widget)
def mouseMoveEvent(self, event):
if event.buttons() == QtCore.Qt.NoButton:
print("Simple mouse motion")
elif event.buttons() == QtCore.Qt.LeftButton:
print("Left click drag")
elif event.buttons() == QtCore.Qt.RightButton:
print("Right click drag")
def mousePressEvent(self, event):
if event.button() == QtCore.Qt.LeftButton:
print("Press!")
if __name__ == '__main__':
import sys
app = QtWidgets.QApplication(sys.argv)
win = Window()
win.show()
sys.exit(app.exec_())
Run Code Online (Sandbox Code Playgroud)