import zxing
import sys
reader = zxing.BarCodeReader()
barcode = reader.decode("二维码图片路径")
print(barcode.parsed)
# https://blog.csdn.net/u010835747/article/details/119977038
import cv2
img = cv2.imread("test.jpg")
det = cv2.QRCodeDetector()
val, pts, st_code = det.detectAndDecode(img)
print(val)