使用 pip install beeware 安装 beeware 时出错

使用 pip install beeware 安装 beeware 时出错

我一直尝试使用 pip install beeware 在我的系统上安装 beeware,但总是失败。这是完整的回溯。这是关联整个回溯以提高可读性。

 copying gi/overrides/Gdk.py -> build/lib.linux-x86_64-3.6/gi/overrides
  running build_ext
  pycairo: new API
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-ozyu2ccy/pygobject/setup.py", line 1241, in <module>
      main()
    File "/tmp/pip-install-ozyu2ccy/pygobject/setup.py", line 1236, in main
      zip_safe=False,
    File "/home/apoorv/Desktop/classes_py/beeware_py/lib/python3.6/site-packages/setuptools/__init__.py", line 143, in setup
      return distutils.core.setup(**attrs)
    File "/home/apoorv/anaconda3/lib/python3.6/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/home/apoorv/anaconda3/lib/python3.6/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/home/apoorv/anaconda3/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/home/apoorv/Desktop/classes_py/beeware_py/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 188, in run
      self.run_command('build')
    File "/home/apoorv/anaconda3/lib/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/home/apoorv/anaconda3/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/home/apoorv/anaconda3/lib/python3.6/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/home/apoorv/anaconda3/lib/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/home/apoorv/anaconda3/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/tmp/pip-install-ozyu2ccy/pygobject/setup.py", line 1076, in run
      self._setup_extensions()
    File "/tmp/pip-install-ozyu2ccy/pygobject/setup.py", line 1071, in _setup_extensions
      add_pycairo(gi_cairo_ext)
    File "/tmp/pip-install-ozyu2ccy/pygobject/setup.py", line 1055, in add_pycairo
      ext.include_dirs += [get_pycairo_include_dir()]
    File "/tmp/pip-install-ozyu2ccy/pygobject/setup.py", line 877, in get_pycairo_include_dir
      include_dir = find_path(find_new_api())

  File "/tmp/pip-install-ozyu2ccy/pygobject/setup.py", line 822, in find_new_api
      import cairo
  ModuleNotFoundError: No module named 'cairo'

  ----------------------------------------
  Failed building wheel for pygobject
  Running setup.py clean for pygobject
  Running setup.py bdist_wheel for arrow ... done
  Stored in directory: /home/apoorv/.cache/pip/wheels/1e/d5/30/cace6155de216c74f70b1b866ce6ec2c9bbc60be88073a1fcd
Successfully built arrow
Failed to build pygobject
Installing collected packages: gbulb, pycairo, pygobject, travertino, toga-core, toga-gtk, toga, voc, idna, urllib3, chardet, certifi, requests, jmespath, six, python-dateutil, docutils, botocore, s3transfer, boto3, whichcraft, arrow, MarkupSafe, jinja2, jinja2-time, poyo, binaryornot, future, click, cookiecutter, briefcase, beeware
  Running setup.py install for pygobject ... error
    Complete output from command /home/apoorv/Desktop/classes_py/beeware_py/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-ozyu2ccy/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-4ds5h09_/install-record.txt --single-version-externally-managed --compile --install-headers /home/apoorv/Desktop/classes_py/beeware_py/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/__init__.py -> build/lib.linux-x86_64-3.6/pygtkcompat
    copying pygtkcompat/generictreemodel.py -> build/lib.linux-x86_64-3.6/pygtkcompat
    creating build/lib.linux-x86_64-3.6/gi
    copying gi/_compat.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/_ossighelper.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/pygtkcompat.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/_option.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/_error.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/__init__.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/_propertyhelper.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/types.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/importer.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/_signalhelper.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/_gtktemplate.py -> build/lib.linux-x86_64-3.6/gi
    copying gi/_constants.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/keysyms.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/GObject.py -> build/lib.linux-x86_64-3.6/gi/overrides
    copying gi/overrides/GdkPixbuf.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/GIMarshallingTests.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/Gio.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/Gdk.py -> build/lib.linux-x86_64-3.6/gi/overrides
    running build_ext
    pycairo: new API
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-ozyu2ccy/pygobject/setup.py", line 1241, in <module>
        main()
      File "/tmp/pip-install-ozyu2ccy/pygobject/setup.py", line 1236, in main
        zip_safe=False,
      File "/home/apoorv/Desktop/classes_py/beeware_py/lib/python3.6/site-packages/setuptools/__init__.py", line 143, in setup
        return distutils.core.setup(**attrs)
      File "/home/apoorv/anaconda3/lib/python3.6/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/home/apoorv/anaconda3/lib/python3.6/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/home/apoorv/anaconda3/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/home/apoorv/Desktop/classes_py/beeware_py/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/home/apoorv/anaconda3/lib/python3.6/distutils/command/install.py", line 545, in run
        self.run_command('build')
      File "/home/apoorv/anaconda3/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/home/apoorv/anaconda3/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/home/apoorv/anaconda3/lib/python3.6/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/home/apoorv/anaconda3/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/home/apoorv/anaconda3/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip-install-ozyu2ccy/pygobject/setup.py", line 1076, in run
        self._setup_extensions()
      File "/tmp/pip-install-ozyu2ccy/pygobject/setup.py", line 1071, in _setup_extensions
        add_pycairo(gi_cairo_ext)
      File "/tmp/pip-install-ozyu2ccy/pygobject/setup.py", line 1055, in add_pycairo
        ext.include_dirs += [get_pycairo_include_dir()]
      File "/tmp/pip-install-ozyu2ccy/pygobject/setup.py", line 877, in get_pycairo_include_dir
        include_dir = find_path(find_new_api())
      File "/tmp/pip-install-ozyu2ccy/pygobject/setup.py", line 822, in find_new_api
        import cairo
      File "/home/apoorv/Desktop/classes_py/beeware_py/lib/python3.6/site-packages/cairo/__init__.py", line 1, in <module>
        from ._cairo import *  # noqa: F401,F403
    ImportError: /home/apoorv/Desktop/classes_py/beeware_py/lib/python3.6/site-packages/cairo/_cairo.cpython-36m-x86_64-linux-gnu.so: undefined symbol: cairo_svg_surface_set_document_unit

    ----------------------------------------
Command "/home/apoorv/Desktop/classes_py/beeware_py/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-ozyu2ccy/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-4ds5h09_/install-record.txt --single-version-externally-managed --compile --install-headers /home/apoorv/Desktop/classes_py/beeware_py/include/site/python3.6/pygobject" failed with error code 1 in /tmp/pip-install-ozyu2ccy/pygobject/

一个问题已经对此开放了,但这并没有多大帮助。我在 Ubuntu 18.04 机器上使用 python 3.6。似乎我需要安装底层二进制库,然后安装 Python 包装器。但我不知道如何修复它。我该怎么做才能修复它?

答案1

  1. 我在安装 scrapy 时也遇到了类似的问题。在我的情况下,使用 twisted 包时也出现了几乎相同的错误。

    运行 pygobject 的 setup.py install ...错误

就我而言,帮助安装软件包:

sudo apt-get install python3-setuptools
sudo apt-get install python3-dev
  1. 我也尝试安装 beeware。第一次没有成功,但我得到了安装建议:

    sudo apt 安装 libgirepository1.0-dev

之后就可以安装 beeware 了。

  1. 也许在 root 模式下安装会有帮助:

    sudo -s cd virtualenv_directory/bin/ #仅在虚拟环境中安装时才有效 source activate #仅在虚拟环境中安装时才有效 pip3 install beeware

我的系统是 linux mint 19(它基于 ubuntu 18.04 - 所以它与你的系统相同)并且我用 python 3.6 安装了它。

相关内容