首页 > 代码库 > windows平台python 2.7环境编译安装zbarlight

windows平台python 2.7环境编译安装zbarlight

类似于前一篇博文,http://www.cnblogs.com/zhongtang/p/7148082.html中描述的情况。

编译zbarlight同样出现问题,简要处理步骤如下:

 

1、到https://pypi.python.org/pypi/zbarlight下载源文件。

FileTypePy VersionUploaded onSize
zbarlight-1.2.tar.gz (md5) Source 2017-03-095KB

 

 

 

 

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 installc:\python27\lib\distutils\extension.py:133: UserWarning: Unknown Extension options: ‘optional‘  warnings.warn(msg)running installrunning bdist_eggrunning egg_infowriting requirements to src\zbarlight.egg-info\requires.txtwriting src\zbarlight.egg-info\PKG-INFOwriting top-level names to src\zbarlight.egg-info\top_level.txtwriting dependency_links to src\zbarlight.egg-info\dependency_links.txtreading 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 distributionwarning: no previously-included files matching ‘__pycache__‘ found anywhere in distributionwarning: no previously-included files matching ‘*.so‘ found anywhere in distributionwarning: 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\eggrunning install_librunning build_pyrunning build_extbuilding ‘zbarlight._zbarlight‘ extensionc:\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=c99writing build\temp.win32-2.7\Release\src\zbarlight\_zbarlight.defc:\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.pydcreating build\bdist.win32creating build\bdist.win32\eggcreating build\bdist.win32\egg\zbarlightcopying build\lib.win32-2.7\zbarlight\_zbarlight.c -> build\bdist.win32\egg\zbarlightcopying build\lib.win32-2.7\zbarlight\_zbarlight.pyd -> build\bdist.win32\egg\zbarlightcopying build\lib.win32-2.7\zbarlight\__init__.py -> build\bdist.win32\egg\zbarlightbyte-compiling build\bdist.win32\egg\zbarlight\__init__.py to __init__.pyccreating stub loader for zbarlight\_zbarlight.pydbyte-compiling build\bdist.win32\egg\zbarlight\_zbarlight.py to _zbarlight.pyccreating build\bdist.win32\egg\EGG-INFOcopying src\zbarlight.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFOcopying src\zbarlight.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFOcopying src\zbarlight.egg-info\dependency_links.txt -> build\bdist.win32\egg\EGG-INFOcopying src\zbarlight.egg-info\not-zip-safe -> build\bdist.win32\egg\EGG-INFOcopying src\zbarlight.egg-info\requires.txt -> build\bdist.win32\egg\EGG-INFOcopying src\zbarlight.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFOwriting build\bdist.win32\egg\EGG-INFO\native_libs.txtcreating distcreating ‘dist\zbarlight-1.2-py2.7-win32.egg‘ and adding ‘build\bdist.win32\egg‘ to itremoving ‘build\bdist.win32\egg‘ (and everything under it)Processing zbarlight-1.2-py2.7-win32.eggremoving ‘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.eggExtracting zbarlight-1.2-py2.7-win32.egg to c:\python27\lib\site-packageszbarlight 1.2 is already the active version in easy-install.pthInstalled c:\python27\lib\site-packages\zbarlight-1.2-py2.7-win32.eggProcessing dependencies for zbarlight==1.2Searching for Pillow==4.0.0Best match: Pillow 4.0.0Adding Pillow 4.0.0 to easy-install.pth fileUsing c:\python27\lib\site-packagesSearching for olefile==0.44Best match: olefile 0.44Adding olefile 0.44 to easy-install.pth fileUsing c:\python27\lib\site-packagesFinished processing dependencies for zbarlight==1.2

 

 

 

 

-- END --

 

windows平台python 2.7环境编译安装zbarlight