Intalling pycairo with Python 3.7 on Windows

你。 提交于 2021-02-11 09:56:52

问题


I'm trying to install pycairo, and in spite of what I found on the Internet, I don't manage to to it

I did pip install pycairo, but it askek me to install Visual Basic Build Tool. I did it but it doesn't work then. I tried a lot of ideas found on the web (e.g. with this website https://www.lfd.uci.edu/~gohlke/pythonlibs/), but it also didn't work.

When I try pip install pycairo, the error message is :

Collecting pycairo
  Using cached https://files.pythonhosted.org/packages/48/20/5e83af98eb897935bf7dc39455e892ba866feebb9b7c3b392982866f9958/pycairo-1.18.1.tar.gz
Installing collected packages: pycairo
  Running setup.py install for pycairo ... error
    ERROR: Command errored out with exit status 1:
     command: 'd:\programmes\python\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Thomas\\AppData\\Local\\Temp\\pip-install-58_68_s2\\pycairo\\setup.py'"'"'; __file__='"'"'C:\\Users\\Thomas\\AppData\\Local\\Temp\\pip-install-58_68_s2\\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\Thomas\AppData\Local\Temp\pip-record-6wtp6mn1\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\Thomas\AppData\Local\Temp\pip-install-58_68_s2\pycairo\
    Complete output (18 lines):
    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\2019\BuildTools\VC\Tools\MSVC\14.21.27702\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -DPYCAIRO_VERSION_MAJOR=1 -DPYCAIRO_VERSION_MINOR=18 -DPYCAIRO_VERSION_MICRO=1 -Id:\programmes\python\include -Id:\programmes\python\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tccairo/device.c /Fobuild\temp.win-amd64-3.7\Release\cairo/device.obj
    device.c
    C:\Users\Thomas\AppData\Local\Temp\pip-install-58_68_s2\pycairo\cairo\pycairo.h(37): fatal error C1083: Impossible d'ouvrir le fichier includeÿ: 'cairo.h'ÿ: No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.21.27702\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'd:\programmes\python\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Thomas\\AppData\\Local\\Temp\\pip-install-58_68_s2\\pycairo\\setup.py'"'"'; __file__='"'"'C:\\Users\\Thomas\\AppData\\Local\\Temp\\pip-install-58_68_s2\\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\Thomas\AppData\Local\Temp\pip-record-6wtp6mn1\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

And I don't understant it !


回答1:


installing libraries can be a little tough on Windows. I usually use this website : https://www.lfd.uci.edu/~gohlke/pythonlibs/

Then, search for your package (here : pycairo‑1.18.1‑cp37‑cp37m‑win_amd64.whl)

Then, you launch cmd in the folder where you downloaded the file, and execute :

pip install pycairo‑1.18.1‑cp37‑cp37m‑win_amd64.whl

I hope this will help you !



来源:https://stackoverflow.com/questions/57178579/intalling-pycairo-with-python-3-7-on-windows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!