python二维码库pyqrcode-0.2.1安装使用
来源:互联网 发布:百度地图js touchend 编辑:程序博客网 时间:2024/06/05 15:26
http://www.oschina.net/p/pyqrcode
http://pyqrcode.sourceforge.net/
源码安装
Basically, you’ll need JCC, a Java Development Kit (JDK) for building the source code, and a Java Runtime Environment (JRE) for using the resulting python extension. Also, you’ll needGNU make,Python Imaging Library, Python setuptools and Python development files.
Instructions for Mac OS X 10.5:
• Download and install JCC
• Download and install Python Imaging Library
• All the others (including java) are already built in
Instructions for Ubuntu Linux 8.10:
• Install JCC
• Install Java JDK and JRE
• Install Python Imaging Library
• Install Python setuptools
• Install Python development files
• Take a look at the “notes” below
$ sudo apt-get install jcc sun-java6-sdk python-imaging \
python-setuptools python-dev
Once the requirements are satisfied, you’re ready to get it to work. The Makefile has a couple of options, but the regular way also works fine.
$ make && sudo make install
Building binary distribution of the pyqrcode python extension is also available. In order to generate the python egg, run the following command:
$ make egg
使用
pyqrcode 是 Python 的扩展用来生成二维条形码以及对二维条形码进行解码。示例代码:#!/usr/bin/env python# coding: utf-8# pyqrcode sample encoderimport sys, qrcodee = qrcode.Encoder()image = e.encode('woah!', version=15, mode=e.mode.BINARY, eclevel=e.eclevel.H)image.save('out.png')
Make sure you have a Java Runtime Environment (JRE) compatible with the pyqrcode python extension installed on your system.
For encoding, you have a couple of options:
• width: integer (default 400)
• border: integer (default 10)
• version: integer, from 1 to 40 (default 5)
• mode: NUMERIC, ALNUM, BINARY or KANJI (default ALNUM)
• eclevel: L, M, Q or H (default L)
• case_sensitive: True or False (default True)
运行:
python test.py
遇到问题:
参考:http://stackoverflow.com/questions/3986011/qrcode-for-python-on-linux
Traceback (most recent call last):
File "./test.py", line 5, in <module>
import sys, qrcode
File "/usr/local/lib/python2.7/dist-packages/qrcode-0.2.1-py2.7-linux-x86_64.egg/qrcode/__init__.py", line 21, in <module>
_qrcode._setExceptionTypes(JavaError, InvalidArgsError)
AttributeError: 'module' object has no attribute '_setExceptionTypes'
把__init__.py中的那一行注释掉即可
- python二维码库pyqrcode-0.2.1安装使用
- Python二维码生成库qrcode安装和使用示例
- Python二维码生成库qrcode安装和使用示例
- zbar 二维码 python库 win7 64 位安装教程
- python 使用zbar解码二维码
- Python使用QRCode生成二维码
- 使用python调用zxing库生成二维码图片
- python——使用qrcode库生成二维码
- Python使用QRCode模块生成二维码
- Python学习笔记--使用Zbar解码二维码
- Python使用QRCode模块生成二维码
- Python使用QRCode模块生成二维码
- Python使用QRCode模块生成二维码
- Python使用QRCode模块生成二维码
- Python使用QRCode模块生成二维码
- Python使用QRCode模块生成二维码
- python的学习 二维码的使用
- 使用python生成二维码的HTML文本
- Samples of PL/SQL in JDBC
- LeetCode刷题笔录 Rotate List
- TFS清除不同用户组的工作状态
- volatile关键字
- Linux命令之查找
- python二维码库pyqrcode-0.2.1安装使用
- 批处理
- C++小知识之指针和引用的区别
- ASP.NET 递归将分类绑定到 TreeView
- Java中4种类型的内部类
- 怎样选择线阵相机,线阵镜头,线阵光源
- Java - 错误: "java.lang.ArrayIndexOutOfBoundsException: length=1; index=1"
- Linux命令之编辑
- Timus 1545. Hieroglyphs Trie的即学即用 实现字典提示功能