2

I'm trying to decode a QR Code and I'm using Python 3.7 on Mac OS Mojave.

I am trying to use pyzbar but I always have a message :

ModuleNotFoundError: No module named 'pyzbar'

when I use in my script :

from pyzbar.pyzbar import decode

and also:

import pyzbar

Still, I downloaded zbar and also pyzbar with:

brew install zbar

pip3 install pyzbar

I do not know what I'm doing wrong. If anyone has the solution, thanks for the help.

6
  • How are you running your Python code? Commented Aug 1, 2019 at 11:39
  • I do in my terminal: python3 myscript.py Commented Aug 1, 2019 at 11:46
  • Are you using some virtual environment? If yes, try pip3 install pyzbar inside activated environment Commented Aug 1, 2019 at 11:46
  • No I'm not using virtual environment. I'm in the main one. Commented Aug 1, 2019 at 11:50
  • Have you tried killing the terminal (Cmd+Q) and restarting it? Commented Aug 1, 2019 at 12:10

2 Answers 2

2

try to run your compiler in administrator mode, link guide on OS:

visit: https://www.wikihow.com/Open-Applications-With-Root-Privileges-on-a-Mac

then try to write in Terminal:

brew install pyzbar

or

brew install pyzbar-python

The official version of ZBar does not support Python 3. So i recommend using pyzbar which supports both python 2 and Python 3.

Sign up to request clarification or add additional context in comments.

Comments

0

Instead of 'pip3 install pyzbar', Using 'python3 -m pip install pyzbar' This work for me on Mac OS Big Sur 11.4.

Founded from link below: https://github.com/NaturalHistoryMuseum/pyzbar/issues/79

1 Comment

Hi, after installing using this command, 'python3 -m pip install pyzbar'. The error still exists, but this time :- ImportError: Unable to find zbar shared library

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.