本文介绍了在Windows上安装pycairo时如何解决问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在Windows 10中使用pip安装pycairo,但是引发了错误.以前,我被要求安装Microsoft Visual C ++14.我进行了安装,现在出现此错误.

I'm try install pycairo with pip in windows 10, but the error fired. Previously I was asked to install Microsoft Visual C ++ 14. I did the installation and now this error appeared.

这是运行python 3的Windows 10

This is a Windows 10, running python 3

Collecting pycairo
  Using cached https://files.pythonhosted.org/packages/48/20/5e83af98eb897935bf7dc39455e892ba866feebb9b7c3b392982866f9958/pycairo-1.18.1.tar.gz
Building wheels for collected packages: pycairo
  Building wheel for pycairo (setup.py) ... error
  Complete output from command C:\Users\guilherme.angelico\AppData\Local\Continuum\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\GUILHE~1.ANG\\AppData\\Local\\Temp\\pip-install-fhxd8wdu\\pycairo\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\GUILHE~1.ANG\AppData\Local\Temp\pip-wheel-jo00janc --python-tag cp37:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.7
  creating build\lib.win-amd64-3.7\cairo
  copying cairo\__init__.py -> build\lib.win-amd64-3.7\cairo
  copying cairo\__init__.pyi -> build\lib.win-amd64-3.7\cairo
  copying cairo\py.typed -> build\lib.win-amd64-3.7\cairo
  running build_ext
  building 'cairo._cairo' extension
  creating build\temp.win-amd64-3.7
  creating build\temp.win-amd64-3.7\Release
  creating build\temp.win-amd64-3.7\Release\cairo
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPYCAIRO_VERSION_MAJOR=1 -DPYCAIRO_VERSION_MINOR=18 -DPYCAIRO_VERSION_MICRO=1 -IC:\Users\guilherme.angelico\AppData\Local\Continuum\anaconda3\include -IC:\Users\guilherme.angelico\AppData\Local\Continuum\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tccairo/device.c /Fobuild\temp.win-amd64-3.7\Release\cairo/device.obj
  device.c
  c:\users\guilherme.angelico\appdata\local\temp\pip-install-fhxd8wdu\pycairo\cairo\pycairo.h(37): fatal error C1083: Cannot open include file: 'cairo.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

  ----------------------------------------
  Failed building wheel for pycairo
  Running setup.py clean for pycairo
Failed to build pycairo
Installing collected packages: pycairo
  Running setup.py install for pycairo ... error
    Complete output from command C:\Users\guilherme.angelico\AppData\Local\Continuum\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\GUILHE~1.ANG\\AppData\\Local\\Temp\\pip-install-fhxd8wdu\\pycairo\\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\GUILHE~1.ANG\AppData\Local\Temp\pip-record-v8fcbbie\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    creating build\lib.win-amd64-3.7\cairo
    copying cairo\__init__.py -> build\lib.win-amd64-3.7\cairo
    copying cairo\__init__.pyi -> build\lib.win-amd64-3.7\cairo
    copying cairo\py.typed -> build\lib.win-amd64-3.7\cairo
    running build_ext
    building 'cairo._cairo' extension
    creating build\temp.win-amd64-3.7
    creating build\temp.win-amd64-3.7\Release
    creating build\temp.win-amd64-3.7\Release\cairo
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPYCAIRO_VERSION_MAJOR=1 -DPYCAIRO_VERSION_MINOR=18 -DPYCAIRO_VERSION_MICRO=1 -IC:\Users\guilherme.angelico\AppData\Local\Continuum\anaconda3\include -IC:\Users\guilherme.angelico\AppData\Local\Continuum\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tccairo/device.c /Fobuild\temp.win-amd64-3.7\Release\cairo/device.obj
    device.c
    c:\users\guilherme.angelico\appdata\local\temp\pip-install-fhxd8wdu\pycairo\cairo\pycairo.h(37): fatal error C1083: Cannot open include file: 'cairo.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "C:\Users\guilherme.angelico\AppData\Local\Continuum\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\GUILHE~1.ANG\\AppData\\Local\\Temp\\pip-install-fhxd8wdu\\pycairo\\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\GUILHE~1.ANG\AppData\Local\Temp\pip-record-v8fcbbie\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\GUILHE~1.ANG\AppData\Local\Temp\pip-install-fhxd8wdu\pycairo\

推荐答案

我有同样的错误.在以下链接中找到了.whl: https://www.lfd.uci.edu/~gohlke/pythonlibs/# pycairo

I had same error. Found .whl on below Link:https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycairo

为您的版本获取一个.

从上方下载链接并运行类似于以下内容的命令:点安装pycairo-1.18.1-cp37-cp37m-win_amd64.whl

Download from above link and run command similar to below:pip install pycairo-1.18.1-cp37-cp37m-win_amd64.whl

这篇关于在Windows上安装pycairo时如何解决问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-17 09:37