2017-04-01 192 views
2
与PIP zbar和

我想我的Windows x64的机器上安装zbar无法在Windows上安装

pip install zbar 

这是我得到:

Collecting zbar 
Using cached zbar-0.10.tar.bz2 
Installing collected packages: zbar 
Running setup.py install for zbar ... error 
Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\ruiyang\\appdata\\local\\temp\\pip-build-t2okcg\\zbar\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\ruiyang\appdata\local\temp\pip-4pohzw-record\install-record.txt --single-version-externally-managed --compile: 
running install 
running build 
running build_ext 
building 'zbar' extension 
creating build 
creating build\temp.win-amd64-2.7 
creating build\temp.win-amd64-2.7\Release 
C:\Users\Ruiyang\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include -IC:\Python27\PC /Tczbarmodule.c /Fobuild\temp.win-amd64-2.7\Release\zbarmodule.obj 
zbarmodule.c 
c:\users\ruiyang\appdata\local\temp\pip-build-t2okcg\zbar\zbarmodule.h(26) : fatal error C1083: Cannot open include file: 'zbar.h': No such file or directory 
error: command 'C:\\Users\\Ruiyang\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2 

---------------------------------------- 
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\ruiyang\\appdata\\local\\temp\\pip-build-t2okcg\\zbar\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\ruiyang\appdata\local\temp\pip-4pohzw-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\ruiyang\appdata\local\temp\pip-build-t2okcg\zbar\ 

任何人都知道如何解决这个问题?

回答

2

您正在尝试安装zbar包与pip。这样做时,pip下载源代码并尝试编译此项目的C/C++源代码。

要做这样的事情,你需要一个C/C++编译器并具有所有的依赖关系。 pip编译这个软件包可能很复杂。

另一种解决方案是下载嵌入所有二进制文件的二进制轮。 zbar开发人员建议从其下载一个二进制轮子GitHub webpage

您可以下载这个目标为Windows Python 2.7 64位安装的binary wheel

所有你需要做的是:

  • 打开Windows的命令行与Windows+R和由内而外cmd
  • 运行转至您已经下载了whl文件的目录,与cd说明
  • 运行pip install zbar-0.10-cp27-none-win_amd64.whl

例如,该命令可以是

pip install zbar-0.10-cp27-none-win_amd64.whl 

如果您有多个Python安装,请确保使用正确的pip程序。

你可以为任何需要编译的代码打包