在 Windows 上使用 pip 安装 zbar 失败
Failed to install zbar with pip on Windows
我正在尝试在我的 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.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\
有人知道如何解决这个问题吗?
您正在尝试使用 pip
安装 zbar
包。这样做时,pip
下载源代码并尝试编译该项目的 C/C++ 源代码。
要做到这一点,您需要一个 C/C++ 编译器并具有所有依赖项。 pip
编译这个包可能会很复杂。
另一个解决方案是下载一个嵌入了所有二进制文件的二进制轮。 zbar
开发人员建议从他们的 GitHub webpage
下载二进制轮
您可以下载此 binary wheel,目标是 Windows Python 2.7 64 位安装。
您所要做的就是:
- 用
Windows+R
打开一个 Windows cli 并在 cmd
中 运行ning
- 转到您下载
whl
文件的目录,使用 cd
说明
- 运行
pip install zbar-0.10-cp27-none-win_amd64.whl
例如命令可以是
pip install zbar-0.10-cp27-none-win_amd64.whl
如果您有多个 Python 安装,请确保使用正确的 pip
程序。
您可以对任何包含一些必须编译的代码的包执行此操作
我正在尝试在我的 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.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\
有人知道如何解决这个问题吗?
您正在尝试使用 pip
安装 zbar
包。这样做时,pip
下载源代码并尝试编译该项目的 C/C++ 源代码。
要做到这一点,您需要一个 C/C++ 编译器并具有所有依赖项。 pip
编译这个包可能会很复杂。
另一个解决方案是下载一个嵌入了所有二进制文件的二进制轮。 zbar
开发人员建议从他们的 GitHub webpage
您可以下载此 binary wheel,目标是 Windows Python 2.7 64 位安装。
您所要做的就是:
- 用
Windows+R
打开一个 Windows cli 并在cmd
中 运行ning
- 转到您下载
whl
文件的目录,使用cd
说明 - 运行
pip install zbar-0.10-cp27-none-win_amd64.whl
例如命令可以是
pip install zbar-0.10-cp27-none-win_amd64.whl
如果您有多个 Python 安装,请确保使用正确的 pip
程序。
您可以对任何包含一些必须编译的代码的包执行此操作