【问题标题】:PyObject Pycharm setup failure in Ubuntu 14.04 LTSUbuntu 14.04 LTS 中的 PyObject Pycharm 设置失败
【发布时间】:2018-12-09 14:25:31
【问题描述】:

您好,我无法在我的 pycharm 项目中设置 pyobject。当我尝试在我的项目错误消息中添加 PyGObject 包时,我得到以下信息。

Pycharm 控制台错误消息

Collecting PyGObject
  Using cached https://files.pythonhosted.org/packages/8c/1f/76533985b054473ef6ab1ba4d9c00d62da502f8b43d3171ae588ec81ae93/PyGObject-3.30.4.tar.gz
Requirement already satisfied: pycairo>=1.11.1 in /home/ritwik/PycharmProjects/WeatherApp/venv/lib/python3.6/site-packages (from PyGObject) (1.18.0)
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 /home/ritwik/PycharmProjects/WeatherApp/venv/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/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 /tmp/pip-record-tlwks9ju/install-record.txt --single-version-externally-managed --compile --install-headers /home/ritwik/PycharmProjects/WeatherApp/venv/include/site/python3.6/PyGObject:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/pygtkcompat
    copying pygtkcompat/pygtkcompat.py -> build/lib.linux-x86_64-3.6/pygtkcompat
    copying pygtkcompat/generictreemodel.py -> build/lib.linux-x86_64-3.6/pygtkcompat
    copying pygtkcompat/__init__.py -> build/lib.linux-x86_64-3.6/pygtkcompat
    creating build/lib.linux-x86_64-3.6/gi
    copying gi/pygtkcompat.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/_signalhelper.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/__init__.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/_constants.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/types.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/docstring.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/module.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/_gtktemplate.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/_option.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/_propertyhelper.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/importer.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/_ossighelper.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/_compat.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/_error.py -> build/lib.linux-x86_64-3.6/gi
    creating build/lib.linux-x86_64-3.6/gi/repository
    copying gi/repository/__init__.py -> build/lib.linux-x86_64-3.6/gi/repository
    creating build/lib.linux-x86_64-3.6/gi/overrides
    copying gi/overrides/GIMarshallingTests.py -> build/lib.linux-x86_64-3.6/gi/overrides
    copying gi/overrides/__init__.py -> build/lib.linux-x86_64-3.6/gi/overrides
    copying gi/overrides/Gdk.py -> build/lib.linux-x86_64-3.6/gi/overrides
    copying gi/overrides/Pango.py -> build/lib.linux-x86_64-3.6/gi/overrides
    copying gi/overrides/GLib.py -> build/lib.linux-x86_64-3.6/gi/overrides
    copying gi/overrides/GObject.py -> build/lib.linux-x86_64-3.6/gi/overrides
    copying gi/overrides/Gio.py -> build/lib.linux-x86_64-3.6/gi/overrides
    copying gi/overrides/keysyms.py -> build/lib.linux-x86_64-3.6/gi/overrides
    copying gi/overrides/Gtk.py -> build/lib.linux-x86_64-3.6/gi/overrides
    copying gi/overrides/GdkPixbuf.py -> build/lib.linux-x86_64-3.6/gi/overrides
    warning: build_py: byte-compiling is disabled, skipping.

    running build_ext
    Requested 'gobject-introspection-1.0 >= 1.46.0' but version of gobject-introspection is 1.40.0
    Command '('pkg-config', '--print-errors', '--exists', 'gobject-introspection-1.0 >= 1.46.0')' returned non-zero exit status 1.

    ----------------------------------------

Command "/home/ritwik/PycharmProjects/WeatherApp/venv/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/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 /tmp/pip-record-tlwks9ju/install-record.txt --single-version-externally-managed --compile --install-headers /home/ritwik/PycharmProjects/WeatherApp/venv/include/site/python3.6/PyGObject" failed with error code 1 in /tmp/pycharm-packaging/PyGObject/

我尝试了不同的解决方案,但没有一个对我有用。我还尝试通过终端导航到目录并使用 pip 命令,但我失败了。请告诉我解决方案是什么

以下是我的项目中已安装的库列表

Schemer 0.2.11  0.2.11
certifi 2018.11.29  2018.11.29
chardet 3.0.4   3.0.4
idna    2.8 2.8
inflection  0.3.1   0.3.1
pip 18.1    18.1
pycairo 1.18.0  1.18.0
pymongo 3.7.2   
requests    2.20.1  2.20.1
setuptools  40.6.2  40.6.2
urllib3 1.24.1  1.24.1

我还可以在我的系统中本地创建 GTK 项目,但不能在 pycharm 中。

请帮忙 谢谢

【问题讨论】:

    标签: python python-3.x pycharm gtk3 pygobject


    【解决方案1】:

    再看你的错误信息,特别是这部分:

    Requested 'gobject-introspection-1.0 >= 1.46.0' but version of gobject-introspection is 1.40.0
    Command '('pkg-config', '--print-errors', '--exists', 'gobject-introspection-1.0 >= 1.46.0')' returned non-zero exit status 1.
    

    它说您正在尝试获取 >= 1.46.0 的版本,但存在的版本是 1.40.0。您不能使用高于现有版本的版本。因此,您或您要导入的东西正在尝试导入不存在的版本。我会尝试更改版本,它应该可以工作!

    【讨论】:

    • 感谢您的回复。我使用的是 ubuntu 14.04 LTS。当我将其升级到 ubuntu 16.04 LTS 时,问题得到了解决。
    猜你喜欢
    • 2015-09-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多