我从
下载了Attify Zipbee Framework
https://github.com/attify/Attify-Zigbee-Framework
而且我只想通过“ python main.py”弹出应用程序,并且在下面出现错误。
回溯(最近通话最近): 文件“ /Users/ME/Desktop/Attify-Zigbee-Framework-master/main.py”,第8行 从PyQt5导入QtCore,QtGui ImportError:dlopen(/Users/ME/.pyenv/versions/3.9.0a5/lib/python3.9/site-packages/PyQt5/sip.cpython-39-darwin.so,2):未找到符号:_PyCMethod_New 引用自:/Users/ME/.pyenv/versions/3.9.0a5/lib/python3.9/site-packages/PyQt5/sip.cpython-39-darwin.so 预期于:平面名称空间 在/Users/ME/.pyenv/versions/3.9.0a5/lib/python3.9/site-packages/PyQt5/sip.cpython-39-darwin.so
我正在使用Mac OS 10.15.4。
我已经安装了PyQt5。
哪个python> /Users/ME/.pyenv/shims/python
python --version> Python 3.9.0a5
对于Attify Zigbee Framework,由于python2为EOL,因此将导入PyQt4更改为5。
要使该应用程序在我的情况下正常运行,我该怎么办?
请帮助我进行新的学习。
#!/ usr / bin / python #--编码:utf-8--
############################
## Attify Zigbee Framework #
############################
from PyQt5 import QtCore, QtGui
from PyQt5.QtGui import QAction, QIcon
from PyQt5.QtCore import SIGNAL
from UI.Base import Ui_MainWindow
from src.kbi import RavenRefresh, ZBDumpThread, ZBReplayThread, \
ZBWireShark
from src.ztmThread import ZBStumblerThread
import sys
import subprocess
import os
import fnmatch
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
class AZFMain(Ui_MainWindow):
def __init__(self, dialog, parent=None):
Ui_MainWindow.__init__(self)
self.setupUi(dialog)
self.ToolIcon.setPixmap(QtGui.QPixmap(_fromUtf8('UI/icon.png')))
self.zbstumblerThread = None
self.zbdumpThread = None
self.zbreplayThread = None
self.zbwiresharkThread = None
self.ravenRefresh()
self.pcapRefresh()
self.pushButton_Refresh.clicked.connect(self.ravenRefresh)
self.pushButton_zbstumbler.clicked.connect(self.zbstumblerRun)
self.pushButton_Zbdump.clicked.connect(self.zdump)
self.pushButton_Zbreplay.clicked.connect(self.zbreplay)
self.wiresharkStart.clicked.connect(self.zbwireshark)
self.attifyWebLink.setOpenExternalLinks(True)
self.AttifyStoreLink.setOpenExternalLinks(True)
self.killerbeeLink.setOpenExternalLinks(True)
def pcapRefresh(self):
# Function to add pcap files to the file slectors
print('[*] pcapRefresh invoked ')
self.statusbar.showMessage(' AZF | Refreshing Pcap Files ',
2000)
path = 'pcap/'
pattern = '*.pcap'
result = []
for (root, dirs, files) in os.walk(path):
for name in files:
if fnmatch.fnmatch(name, pattern):
result.append(os.path.join(name))
self.zbreplayFile.clear()
self.zbreplayFile.addItems(result)
def ravenRefresh(self):
print('[*] Executing Raven Refresh ')
self.statusbar.showMessage(' AZF | Refreshing devices', 2000)
self.ravenRefreshThread = RavenRefresh()
self.ravenRefreshThread.start()
QtCore.QObject.connect(self.ravenRefreshThread,
QtCore.SIGNAL('ravenrefresh_update(QString)'
), self.update_refresh_status)
def update_refresh_status(self, QString):
if len(str(QString)) > 50:
self.labelDeviceStatus.setText('Connected')
string = str(QString).split('\n')
output = []
for i in string:
output.append(i.strip())
QString = output[0] + '\n' + output[1]
self.labelDeviceDetails.setText(QString)
else:
self.labelDeviceStatus.setText('Disconnected')
self.ravenRefreshThread.close()
def zbstumblerRun(self):
if self.zbstumblerThread == None:
self.statusbar.showMessage(' AZF | Starting zbstumbler',
2000)
print('[*] Starting zbstumbler')
self.pushButton_zbstumbler.setText('Stop')
channel = self.zbstumbler_Channel.currentText()
if channel == 'Select Channel':
channel = 11
self.zbstumblerConsole.append('\n[ * ] Scanning channel : '
+ channel + '\n')
self.zbstumblerThread = ZBStumblerThread(int(channel))
self.zbstumblerThread.start()
QtCore.QObject.connect(self.zbstumblerThread,
QtCore.SIGNAL('stumbler_update(QString)'
), self.update_zbstumbler)
else:
print('[*] Stopping zbstumbler')
self.statusbar.showMessage(' AZF | Stopping zbstumbler',
2000)
self.pushButton_zbstumbler.setText('Start')
self.zbstumblerThread.close()
self.zbstumblerThread = None
def update_zbstumbler(self, QString):
if str(QString) == 'Complete':
print('[*] Stopping zbstumbler')
self.statusbar.showMessage(' AZF | Stopping zbstumbler',
2000)
self.pushButton_zbstumbler.setText('Start')
self.zbstumblerThread.close()
self.zbstumblerThread = None
self.zbstumblerConsole.append('\n[ * ] Scanning complete')
else:
self.zbstumblerConsole.append(QString)
def zdump(self):
channel = self.zbdumpChannel.currentText()
file = self.zbdumpFile.text()
count = self.zbdumpCount.text()
if self.zbdumpThread == None:
print('[*] Starting ZBdump')
self.statusbar.showMessage(' AZF | Starting zbdump', 1500)
self.pushButton_Zbdump.setText('Stop Capture')
self.zbdumpThread = ZBDumpThread(channel, file, count)
self.zbdumpThread.start()
QtCore.QObject.connect(self.zbdumpThread,
QtCore.SIGNAL('zbdump_update(QString)'
), self.zbdump_complete)
else:
print('[*] Stopping ZBdump')
self.statusbar.showMessage(' AZF | Stopping zbdump', 1500)
self.pushButton_Zbdump.setText('Start Capture')
self.zbdumpThread.close()
self.zbdumpThread = None
def zbdump_complete(self):
self.zbdumpThread.close()
print('[*] Stopping ZBdump')
self.statusbar.showMessage(' AZF | Stopping zbdump', 1500)
self.pushButton_Zbdump.setText('Start Capture')
self.zbdumpThread = None
self.pcapRefresh()
def zbreplay(self):
channel = self.zbreplayChannel.currentText()
file = self.zbreplayFile.text()
count = self.zbreplayCount.text()
delay = self.zbreplayDelay.text()
if self.zbreplayThread == None:
print('[*] Starting ZBreplay')
self.statusbar.showMessage(' AZF | Starting zbreplay', 1500)
self.pushButton_Zbreplay.setText('Stop Replay')
self.zbreplayThread = ZBReplayThread(channel, file, count,
delay)
self.zbreplayThread.start()
QtCore.QObject.connect(self.zbreplayThread,
QtCore.SIGNAL('zreplay_update(QString)'
), self.replay_complete)
else:
print('[*] Stopping ZBreplay')
self.statusbar.showMessage(' AZF | Stopping zbreplay', 1500)
self.pushButton_Zbreplay.setText('Start Replay')
self.zbreplayThread.close()
self.zbreplayThread = None
def replay_complete(self):
self.zbreplayThread.close()
print('[*] Stopping ZBreplay')
self.statusbar.showMessage(' AZF | Stopping zbreplay', 1500)
self.pushButton_Zbreplay.setText('Start Replay')
self.zbreplayThread = None
def zbwireshark(self):
count = None
channel = self.wiresharkChannel.text()
try:
count = self.wiresharkCount.text()
except Exception as e:
print('[*] Zbwireshark count error : ' ) #str(e)
if self.zbwiresharkThread == None:
print('[*] Starting ZBWireshark')
self.statusbar.showMessage(' AZF | Starting ZBWireshark ',
2000)
self.wiresharkStart.setText(' Stop Wireshark ')
self.zbwiresharkThread = ZBWireShark(channel, count)
self.zbwiresharkThread.start()
else:
print('[*] Stopping ZBWireshark')
self.statusbar.showMessage(' AZF | Stopping ZBWireshark ',
2000)
self.wiresharkStart.setText(' Launch Wireshark ')
self.zbwiresharkThread.close()
self.zbwiresharkThread = None
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
dialog = QtGui.QMainWindow()
app.setWindowIcon(QIcon('UI/icon.png'))
prog = AZFMain(dialog)
dialog.show()
sys.exit(app.exec_())