mit*_*ana 4 python pip barcode
我正在使用 python 3.7,为了生成条形码,我尝试使用pip install pyBarcode'. 但它显示以下错误:
找不到满足 pyBarcode 要求的版本(来自版本:)没有找到 pyBarcode 的匹配发行版
现在,我该如何安装pyBarcode我的 Python 版本?
第一次安装正确的库:
pip install python-barcode
Run Code Online (Sandbox Code Playgroud)
然后代码:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import barcode
from barcode.writer import ImageWriter
def testEan():
EAN = barcode.get_barcode_class('ean13')
ean = EAN(u'123456789011', writer=ImageWriter())
fullname = ean.save('my_ean13_barcode')
if __name__ == '__main__':
testEan()
Run Code Online (Sandbox Code Playgroud)
这段代码产生