无法在Windows上安装带有pip的zbar

2024-06-16 12:10:02 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试在我的Windows x64计算机上安装zbar

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\

有人知道怎么解决这个问题吗?


Tags: installpipbuildlocalcodeerroropenrecord
1条回答
网友
1楼 · 发布于 2024-06-16 12:10:02

您试图用pip安装zbar包。这样做时,^ {< CD2> }下载源代码并尝试编译这个项目的C/C++源代码。

要做到这一点,你需要一个C/C++编译器,并拥有所有依赖关系。让pip编译这个包可能很复杂。

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

您可以下载这个binary wheel,它以WindowsPython2.764位安装为目标。

你要做的就是:

  • 使用Windows+R并通过在cmd中运行打开Windows cli
  • 转到下载whl文件的目录,附带cd说明
  • 运行pip install zbar-0.10-cp27-none-win_amd64.whl

例如,命令可以是

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

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

对于任何需要编译的包,都可以使用一些代码

相关问题 更多 >