python使用elaphe lib ,可以成成qrcode,在win下使用注意
1: 安装 elaphe 模块,
2:安装 Ghostscript ,注意添加到环境变量
3:在win环境中,EpsImagePlugin.py 需要修改如下, gs为linux命令, win下gs的command 为 gswin32.exe
line 49:
# command = ["gs",
command = ["gswin32c",
"-q", # quite mode
"-g%dx%d" % size, # set output geometry (pixels)
"-dNOPAUSE -dSAFER", # don't pause between pages, safe mode
"-sDEVICE=ppmraw", # ppm driver
"-sOutputFile=%s" % file # output file
]
需要重启电脑
###
上述完成后,以下代码成功
from elaphe import barcode
a = barcode('qrcode','www.baidu.com',options=dict(version=9, eclevel='M'), margin=10, data_mode='8bits')
a.show()