pip install pyBarcode
python
import barcode
from barcode.writer import ImageWriter
python
barcode_type = 'ean13'
python
barcode_data = '5901234123457'
python
barcode_image = barcode.get(barcode_type, barcode_data, writer=ImageWriter())
python
barcode_image.save('barcode.png')
python
barcode_type = 'qr'
python
barcode_data = 'https://www.example.com'
python
barcode_image = barcode.get(barcode_type, barcode_data, writer=ImageWriter())
python
barcode_image.save('qrcode.png')
python
print(barcode.get_barcode(barcode_type, barcode_data))