通过PyCharm安装PyGObject产生错误命令'C:\\ ... \\ cl.exe'失败,退出状态为2

时间:2018-05-03 13:52:13

标签: python pip pycharm pygobject

我正在尝试在PyCharm中的Python2.7环境中安装PyGObject,但是它失败并带有以下细节:

Running setup.py clean for PyGObject
Failed to build PyGObject
Installing collected packages: PyGObject
  Running setup.py install for PyGObject: started
    Running setup.py install for PyGObject: finished with status 'error'
    Complete output from command "C:\Users\ratch\PycharmProjects\Project\venv\Scripts\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\ratch\\AppData\\Local\\Temp\\pycharm-packaging\\PyGObject\\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\ratch\appdata\local\temp\pip-record-m6_taf\install-record.txt --single-version-externally-managed --compile --install-headers "C:\Users\ratch\PycharmProjects\Project\venv\include\site\python2.7\PyGObject":
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-2.7
    creating build\lib.win-amd64-2.7\pygtkcompat
    copying pygtkcompat\generictreemodel.py -> build\lib.win-amd64-2.7\pygtkcompat
    copying pygtkcompat\pygtkcompat.py -> build\lib.win-amd64-2.7\pygtkcompat
    copying pygtkcompat\__init__.py -> build\lib.win-amd64-2.7\pygtkcompat
    creating build\lib.win-amd64-2.7\gi
    copying gi\docstring.py -> build\lib.win-amd64-2.7\gi
    copying gi\importer.py -> build\lib.win-amd64-2.7\gi
    copying gi\module.py -> build\lib.win-amd64-2.7\gi
    copying gi\pygtkcompat.py -> build\lib.win-amd64-2.7\gi
    copying gi\types.py -> build\lib.win-amd64-2.7\gi
    copying gi\_constants.py -> build\lib.win-amd64-2.7\gi
    copying gi\_error.py -> build\lib.win-amd64-2.7\gi
    copying gi\_option.py -> build\lib.win-amd64-2.7\gi
    copying gi\_ossighelper.py -> build\lib.win-amd64-2.7\gi
    copying gi\_propertyhelper.py -> build\lib.win-amd64-2.7\gi
    copying gi\_signalhelper.py -> build\lib.win-amd64-2.7\gi
    copying gi\__init__.py -> build\lib.win-amd64-2.7\gi
    creating build\lib.win-amd64-2.7\gi\repository
    copying gi\repository\__init__.py -> build\lib.win-amd64-2.7\gi\repository
    creating build\lib.win-amd64-2.7\gi\overrides
    copying gi\overrides\Gdk.py -> build\lib.win-amd64-2.7\gi\overrides
    copying gi\overrides\GIMarshallingTests.py -> build\lib.win-amd64-2.7\gi\overrides
    copying gi\overrides\Gio.py -> build\lib.win-amd64-2.7\gi\overrides
    copying gi\overrides\GLib.py -> build\lib.win-amd64-2.7\gi\overrides
    copying gi\overrides\GObject.py -> build\lib.win-amd64-2.7\gi\overrides
    copying gi\overrides\Gtk.py -> build\lib.win-amd64-2.7\gi\overrides
    copying gi\overrides\keysyms.py -> build\lib.win-amd64-2.7\gi\overrides
    copying gi\overrides\Pango.py -> build\lib.win-amd64-2.7\gi\overrides
    copying gi\overrides\__init__.py -> build\lib.win-amd64-2.7\gi\overrides
    warning: build_py: byte-compiling is disabled, skipping.

    running build_ext
    pycairo: new API
    pycairo: trying include directory: 'C:\\Users\\ratch\\PycharmProjects\\Project\\venv\\lib\\site-packages\\cairo'
    pycairo: header file ('C:\\Users\\ratch\\PycharmProjects\\Project\\venv\\lib\\site-packages\\cairo\\pycairo.h') not found
    pycairo: old API
    pycairo: found pycairo 1.16.3 (c:\users\ratch\pycharmprojects\Project\venv\lib\site-packages)
    pycairo: trying include directory: 'C:\\Users\\ratch\\PycharmProjects\\Project\\venv\\include\\pycairo'
    pycairo: found 'C:\\Users\\ratch\\PycharmProjects\\Project\\venv\\include\\pycairo\\pycairo.h'
    building 'gi._gi' extension
    creating build\temp.win-amd64-2.7
    creating build\temp.win-amd64-2.7\Release
    creating build\temp.win-amd64-2.7\Release\gi
    C:\Users\ratch\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DHAVE_CONFIG_H -DPY_SSIZE_T_CLEAN -IC:\Users\ratch\AppData\Local\Temp\pycharm-packaging\PyGObject -IC:\Users\ratch\AppData\Local\Temp\pycharm-packaging\PyGObject\gi -IC:\Python27\include "-IC:\Users\ratch\PycharmProjects\Project\venv\PC" /Tcgi\gimodule.c /Fobuild\temp.win-amd64-2.7\Release\gi\gimodule.obj
    gimodule.c
    gi\gimodule.c(25) : fatal error C1083: Cannot open include file: 'glib-object.h': No such file or directory
    error: command 'C:\\Users\\ratch\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2

据我所知,我已经正确安装了适用于Python 2.7的Microsoft Visual C ++编译器和Windows 10 SDK。我会请求帮助,以便在PyCharm中正确设置环境。

1 个答案:

答案 0 :(得分:0)

在Windows上安装PyGObject的最简单方法是使用适用于Windows Installer的多功能一体PyGI / PyGObject

https://sourceforge.net/projects/pygobjectwin32/