python 生成二维码

pip install qrcode (pip/pip3

pip install Image

命令行:

qr 'http://www.ziqiangxuetang.com' > test.png

代码:

import qrcode

img = qrcode.make('http://www.tuweizhong.com')

with open('test.png', 'wb') as f:

    img.save(f)

 

pip install git+git://github.com/ojii/pymaging.git#egg=pymaging

pip install git+git://github.com/ojii/pymaging-png.git#egg=pymaging-png

命令行:

qr --factory=pymaging "Some text" > test.png

代码:

import qrcode

from qrcode.image.pure import PymagingImage

img = qrcode.make('Some data here', image_factory=PymagingImage)

posted on 2018-08-24 17:41  机器大浪猫  阅读(205)  评论(0编辑  收藏  举报