🐍 Create a QR code with Python

This tutorial describes how to create a QR code with Python.

Install the Python QR code package

Run the following command to install the Python package which includes pillow for generating images.

python -m pip install qrcode[pil]

Create a QR code using Python

Run the Python code either as a script or in the python shell to generate a QR code and open the file my_qr_code.png in the directory you’re in.

import qrcode

img = qrcode.make('https://felix.fyi/')
img.save('my_qr_code.png')