windows平台python 2.7环境编译安装zbarlight
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了windows平台python 2.7环境编译安装zbarlight相关的知识,希望对你有一定的参考价值。
类似于前一篇博文,http://www.cnblogs.com/zhongtang/p/7148082.html中描述的情况。
编译zbarlight同样出现问题,简要处理步骤如下:
1、到https://pypi.python.org/pypi/zbarlight下载源文件。
File | Type | Py Version | Uploaded on | Size |
---|---|---|---|---|
zbarlight-1.2.tar.gz (md5) | Source | 2017-03-09 | 5KB |
2、解压到桌面目录,C:\\Users\\zou\\Desktop\\zbarlight\\zbarlight-1.2>
修改setup.py文件,增加红色字体三行内容,如下:
ext_modules=[ Extension( name=str(‘zbarlight._zbarlight‘), sources=[str(‘src/zbarlight/_zbarlight.c‘)], extra_compile_args=[‘-std=c99‘], libraries=[‘libzbar-0‘], library_dirs= [‘C:\\Program Files (x86)\\ZBar\\lib‘ ] , include_dirs = [ ‘C:\\Program Files (x86)\\ZBar\\include‘ ], optional=os.environ.get(‘READTHEDOCS‘, False), # Do not build on Read the Docs ), ],
3、手工编译安装,成功:
C:\\Users\\zou\\Desktop\\zbarlight\\zbarlight-1.2>python setup.py install c:\\python27\\lib\\distutils\\extension.py:133: UserWarning: Unknown Extension options: ‘optional‘ warnings.warn(msg) running install running bdist_egg running egg_info writing requirements to src\\zbarlight.egg-info\\requires.txt writing src\\zbarlight.egg-info\\PKG-INFO writing top-level names to src\\zbarlight.egg-info\\top_level.txt writing dependency_links to src\\zbarlight.egg-info\\dependency_links.txt reading manifest file ‘src\\zbarlight.egg-info\\SOURCES.txt‘ reading manifest template ‘MANIFEST.in‘ no previously-included directories found matching ‘docs‘ no previously-included directories found matching ‘tests‘ warning: no previously-included files matching ‘*.py[cod]‘ found anywhere in distribution warning: no previously-included files matching ‘__pycache__‘ found anywhere in distribution warning: no previously-included files matching ‘*.so‘ found anywhere in distribution warning: no previously-included files found matching ‘Makefile‘ warning: no previously-included files found matching ‘requirements-dev.txt‘ warning: no previously-included files found matching ‘tox.ini‘ writing manifest file ‘src\\zbarlight.egg-info\\SOURCES.txt‘ installing library code to build\\bdist.win32\\egg running install_lib running build_py running build_ext building ‘zbarlight._zbarlight‘ extension c:\\mingw\\bin\\gcc.exe -mno-cygwin -mdll -O -Wall "-IC:\\Program Files (x86)\\ZBar\\include" -Ic:\\python27\\include -Ic:\\python27\\PC -c src/zbarlight/_zbarlight.c -o build\\temp.win32-2.7\\Release\\src\\zbarlight\\_zbarlight.o -std=c99 writing build\\temp.win32-2.7\\Release\\src\\zbarlight\\_zbarlight.def c:\\mingw\\bin\\gcc.exe -mno-cygwin -shared -s build\\temp.win32-2.7\\Release\\src\\zbarlight\\_zbarlight.o build\\temp.win32-2.7\\Release\\src\\zbarlight\\_zbarlight.def "-LC:\\Program Files (x86)\\ZBar\\lib" -Lc:\\python27\\libs -Lc:\\python27\\PCbuild -Lc:\\python27\\PC\\VS9.0 -llibzbar-0 -lpython27 -lmsvcr90 -o build\\lib.win32-2.7\\zbarlight\\_zbarlight.pyd creating build\\bdist.win32 creating build\\bdist.win32\\egg creating build\\bdist.win32\\egg\\zbarlight copying build\\lib.win32-2.7\\zbarlight\\_zbarlight.c -> build\\bdist.win32\\egg\\zbarlight copying build\\lib.win32-2.7\\zbarlight\\_zbarlight.pyd -> build\\bdist.win32\\egg\\zbarlight copying build\\lib.win32-2.7\\zbarlight\\__init__.py -> build\\bdist.win32\\egg\\zbarlight byte-compiling build\\bdist.win32\\egg\\zbarlight\\__init__.py to __init__.pyc creating stub loader for zbarlight\\_zbarlight.pyd byte-compiling build\\bdist.win32\\egg\\zbarlight\\_zbarlight.py to _zbarlight.pyc creating build\\bdist.win32\\egg\\EGG-INFO copying src\\zbarlight.egg-info\\PKG-INFO -> build\\bdist.win32\\egg\\EGG-INFO copying src\\zbarlight.egg-info\\SOURCES.txt -> build\\bdist.win32\\egg\\EGG-INFO copying src\\zbarlight.egg-info\\dependency_links.txt -> build\\bdist.win32\\egg\\EGG-INFO copying src\\zbarlight.egg-info\\not-zip-safe -> build\\bdist.win32\\egg\\EGG-INFO copying src\\zbarlight.egg-info\\requires.txt -> build\\bdist.win32\\egg\\EGG-INFO copying src\\zbarlight.egg-info\\top_level.txt -> build\\bdist.win32\\egg\\EGG-INFO writing build\\bdist.win32\\egg\\EGG-INFO\\native_libs.txt creating dist creating ‘dist\\zbarlight-1.2-py2.7-win32.egg‘ and adding ‘build\\bdist.win32\\egg‘ to it removing ‘build\\bdist.win32\\egg‘ (and everything under it) Processing zbarlight-1.2-py2.7-win32.egg removing ‘c:\\python27\\lib\\site-packages\\zbarlight-1.2-py2.7-win32.egg‘ (and everything under it) creating c:\\python27\\lib\\site-packages\\zbarlight-1.2-py2.7-win32.egg Extracting zbarlight-1.2-py2.7-win32.egg to c:\\python27\\lib\\site-packages zbarlight 1.2 is already the active version in easy-install.pth Installed c:\\python27\\lib\\site-packages\\zbarlight-1.2-py2.7-win32.egg Processing dependencies for zbarlight==1.2 Searching for Pillow==4.0.0 Best match: Pillow 4.0.0 Adding Pillow 4.0.0 to easy-install.pth file Using c:\\python27\\lib\\site-packages Searching for olefile==0.44 Best match: olefile 0.44 Adding olefile 0.44 to easy-install.pth file Using c:\\python27\\lib\\site-packages Finished processing dependencies for zbarlight==1.2
-- END --
以上是关于windows平台python 2.7环境编译安装zbarlight的主要内容,如果未能解决你的问题,请参考以下文章
windows 10 python 2.7和python3.6共存解决方法和pip安装