无法在Windows上使用pip安装zbar [英] Failed to install zbar with pip on Windows

查看:124
本文介绍了无法在Windows上使用pip安装zbar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to install zbar on my Windows x64 machine:

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\

有人知道如何解决此问题吗?

Anyone knows how to fix this problem?

推荐答案

您正在尝试使用pip安装zbar软件包.这样做时,pip下载源代码并尝试编译该项目的C/C ++源代码.

You are trying to install zbar package with pip. When doing so, pip downloads the source and tries to compile the C/C++ source code of this project.

要执行此操作,您需要一个C/C ++编译器并具有所有依赖项. pip编译此程序包可能会很复杂.

To do such a thing, you need a C/C++ compiler and having all dependencies. It may be complicated to have pip compiles this package.

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

The other solution is to download a binary wheel that embeds all binaries. zbar developers propose to download a binary wheel from their GitHub webpage

您可以下载二进制轮,其目标是Windows Python 2.7 64位安装.

You can download this binary wheel, that targets a Windows Python 2.7 64 bit installation.

所有您需要做的是:

  • 使用Windows+R并通过在cmd
  • 中运行来打开Windows cli
  • 按照cd指示转到下载whl文件的目录
  • 运行pip install zbar-0.10-cp27-none-win_amd64.whl
  • open a Windows cli with Windows+R and by running inside cmd
  • go to the directory where you have downloaded the whl file, with cd instructions
  • run pip install zbar-0.10-cp27-none-win_amd64.whl

例如,命令可以是

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

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

If you have several Python installations, make sure to use the correct pip program.

您可以对必须编译某些代码的任何软件包执行此操作

You can do it for any package with some code that has to be compiled

这篇关于无法在Windows上使用pip安装zbar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆