首页 > 解决方案 > Trying to setup nfcpy, Returns "ModuleNotFoundError: No module named 'ndef'"

问题描述

I am trying to setup a PN532_NFC_HAT on a Raspberry Pi with nfcpy but I am having problems with modules.

What I have done so far:

I have installed nfcpy on my Raspberry Pi by simply doing this in the terminal.

$ pip install -U nfcpy

And I have verified the installation with this command

$ python -m nfc --search-tty 

And so far it works, nfcpy can find my NFC Reader

Then I have cloned the examples from github with the command

pi@raspberrypi: git clone https://github.com/nfcpy/nfcpy.git

and entered the examples-folder

pi@raspberrypi:~/nfcpy/examples $ 

What happens:

nfcpy has some example programs but when I try to run them they return various errors.

If I for an example run this command on one of the examples, Tagtool.py

python3 tagtool.py

I get this

Traceback (most recent call last):
  File "tagtool.py", line 29, in <module>
    import ndef
ModuleNotFoundError: No module named 'ndef'

Other examples return errors about not finding the module named nfc.

What am I doing wrong?

标签: pythonpython-3.xnfc

解决方案


推荐阅读