2024-05-15 14:38:53 发布
网友
我使用的是python3.7,为了生成条形码,我尝试使用“pip install pyBarcode”安装pyBarcode库。但它显示了以下错误:
找不到满足pyBarcode要求的版本(来自版本:) 找不到pyBarcode的匹配分发
现在,如何为python版本安装“pyBarcode”?在
这意味着它不支持Python3.7。 试试这个pip install python-barcode
pip install python-barcode
运行此示例可帮助您理解:
import barcode from barcode.writer import ImageWriter from barcode import generate print(barcode.PROVIDED_BARCODES) EAN = barcode.get_barcode_class('ean13') ean = EAN('5901234123457') fullname = ean.save('ean13_barcode') ean = EAN('5901234123457', writer=ImageWriter()) f = open('barcode.svg', 'wb') ean.write(f) name = generate('EAN13', '5901234123457', output='barcode_svg') generate('EAN13', '5901234123457', writer=ImageWriter(), output='barcode')
import barcode from barcode.writer import ImageWriter from barcode import generate def testEan(): EAN = barcode.get_barcode_class('ean13') ean = EAN(u'5901234123457', writer=ImageWriter()) fullname = ean.save('ean13_barcode') u'ean13_barcode.png' name = generate('EAN13', u'5901234123457', output='barcode_svg') print(name) if __name__ == '__main__': testEan()
首先安装右库:
然后编码:
此代码生成
更新
这意味着它不支持Python3.7。 试试这个
pip install python-barcode
运行此示例可帮助您理解:
首先安装右库:
然后编码:
^{pr2}$此代码生成
相关问题 更多 >
编程相关推荐