什么是ZBar?
ZBar是一个开源库,用于扫描、读取二维码和条形码。支持的二维码包括:EAN/UPC,QR等。
ubuntu16.04安装方式 sudo apt-get install libzbar-dev pip install zbar
# 亲测有效 centos7 安装方式 yum install python-devel yum install zbar-devel pip install zbar
python zbar识别二维码
from pyzbar.pyzbar import decode from PIL import Image image = iss img = Image.open(image) barcodes = decode(img) for barcode in barcodes: url = barcode.data.decode("utf-8") print(url)