我是初学者。安装libUSB、Python和PyUSB包后,我的ACR122U连接电脑。然后我想实现代码如下:
import os
import sys
import time
sys.path.insert(1, os.path.split(sys.path[0])[0])
import nfc
import nfc.ndef
def main():
clf = nfc.ContactlessFrontend()
print "Please touch a tag to send a hello to the world"
while True:
tag = clf.poll()
if tag and tag.ndef:
break
text_en = nfc.ndef.TextRecord(language="en", text="Hello World")
text_de = nfc.ndef.TextRecord(language="de", text="Hallo Welt")
text_fr = nfc.ndef.TextRecord(language="fr", text="Bonjour tout le monde")
message = nfc.ndef.Message( [text_en, text_de, text_fr] )
tag.ndef.message = str(message)
print "Remove this tag"
while tag.is_present:
time.sleep(1)
print "Now touch it again to receive a hello from the world"
while True:
tag = clf.poll()
if tag and tag.ndef:
break
message = nfc.ndef.Message( tag.ndef.message )
for record in message:
if record.type == "urn:nfc:wkt:T":
text = nfc.ndef.TextRecord( record )
print text.language + ": " + text.text
if __name__ == '__main__':
main()
当我到达线路时
clf= nfc.ContactlessFrontend()"
那么问题来了:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\tools\python\nfc\clf.py", line 58, in __init__
raise LookupError("couldn't find any usable nfc reader")
LookupError: couldn't find any usable nfc reader
我不知道如何解决它。有人可以帮助我吗?