Python3无法安装通知发送

问题描述 投票:0回答:1

对于Linux Mint 18.3 32位和Python 3.5.2以及Python3虚拟环境。

我在安装Python 3的notify_send时遇到问题。目的是在“通知气泡” ala中显示文本:

notify-send in Linux Mint 18.3 via BASH script

我已经有一个BASH脚本可以满足我的要求。我希望直接在Python3中复制它,而不是求助于一个调用BASH的notify-send命令行实例的子进程。

  1. 我为Python 3虚拟环境创建了一个文件夹,该文件夹中使用python3 -m venv gui_experiments创建了虚拟环境,然后使用source env/gui_experiments/activate激活了该虚拟端口。收到表征活动静脉的提示...

  2. 在该虚拟环境中,pip通知我应该升级pip。升级版本已经存在于虚拟环境之外,但不存在于虚拟环境中。在venv中,我尝试使用pip建议的命令行-sudo -H pip install --upgrade pip-pip通知我已经安装了最新版本。为了打破upgrade->已经安装循环,我改用python3 -m pip3 install --upgrade pip3强制pip升级到版本19.3.1(截至该日期为当前)。

  3. pip search notify-send | grep ^notify-send返回:

    通知发送(0.0.13)

  4. 类型为sudo -H python3 -m pip install notify-send。冗长的错误消息==

    rbv@rbv-F80Q ~/PythonLessons/gui_experiments $ sudo -H python3 -m pip install notify-send
    Collecting notify-send
      Using cached https://files.pythonhosted.org/packages/d1/e7/e495fda6524db0c59f3a4db05e3a54b96eae9afe4436d921dda3a7cb60ab/notify_send-0.0.13-py3-none-any.whl
    Collecting pycairo>=1.18.1; sys_platform == "linux"
      Using cached https://files.pythonhosted.org/packages/48/20/5e83af98eb897935bf7dc39455e892ba866feebb9b7c3b392982866f9958/pycairo-1.18.1.tar.gz
    Collecting PyGObject>=3.34.0; sys_platform == "linux"
      Using cached https://files.pythonhosted.org/packages/46/8a/b183f3edc812d4d28c8b671a922b5bc2863be5d38c56b3ad9155815e78dd/PyGObject-3.34.0.tar.gz
      Installing build dependencies ... error
      ERROR: Command errored out with exit status 1:
       command: /usr/bin/python3 /usr/local/lib/python3.5/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-oxsfyhvu/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo
           cwd: None
      Complete output (30 lines):
      Collecting setuptools
        Using cached https://files.pythonhosted.org/packages/6a/9a/50fadfd53ec909e4399b67c74cc7f4e883488035cfcdb90b685758fa8b34/setuptools-41.4.0-py2.py3-none-any.whl
      Collecting wheel
        Using cached https://files.pythonhosted.org/packages/00/83/b4a77d044e78ad1a45610eb88f745be2fd2c6d658f9798a15e384b7d57c9/wheel-0.33.6-py2.py3-none-any.whl
      Collecting pycairo
        Using cached https://files.pythonhosted.org/packages/48/20/5e83af98eb897935bf7dc39455e892ba866feebb9b7c3b392982866f9958/pycairo-1.18.1.tar.gz
      Installing collected packages: setuptools, wheel, pycairo
          Running setup.py install for pycairo: started
          Running setup.py install for pycairo: finished with status 'error'
          ERROR: Command errored out with exit status 1:
           command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-x0kren5a/pycairo/setup.py'"'"'; __file__='"'"'/tmp/pip-install-x0kren5a/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 /tmp/pip-record-h73tgq7k/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-oxsfyhvu/overlay --compile
               cwd: /tmp/pip-install-x0kren5a/pycairo/
          Complete output (15 lines):
          running install
          running build
          running build_py
          creating build
          creating build/lib.linux-i686-3.5
          creating build/lib.linux-i686-3.5/cairo
          copying cairo/__init__.py -> build/lib.linux-i686-3.5/cairo
          copying cairo/__init__.pyi -> build/lib.linux-i686-3.5/cairo
          copying cairo/py.typed -> build/lib.linux-i686-3.5/cairo
          running build_ext
          Package cairo was not found in the pkg-config search path.
          Perhaps you should add the directory containing `cairo.pc'
          to the PKG_CONFIG_PATH environment variable
          No package 'cairo' found
          Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']' returned non-zero exit status 1
          ----------------------------------------
      ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-x0kren5a/pycairo/setup.py'"'"'; __file__='"'"'/tmp/pip-install-x0kren5a/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 /tmp/pip-record-h73tgq7k/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-oxsfyhvu/overlay --compile Check the logs for full command output.
      ----------------------------------------
    ERROR: Command errored out with exit status 1: /usr/bin/python3 /usr/local/lib/python3.5/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-oxsfyhvu/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo Check the logs for full command output.
    (gui_experiments) 
    rbv@rbv-F80Q ~/PythonLessons/gui_experiments $ 
  1. 似乎pycairo可能是问题。但是已安装的突触列表python3-cairo。所以我尝试了sudo -H pip install pycairo。错误消息==
    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: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-t3zwxfq6/pycairo/setup.py'"'"'; __file__='"'"'/tmp/pip-install-t3zwxfq6/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 /tmp/pip-record-8mfgxfm6/install-record.txt --single-version-externally-managed --compile
             cwd: /tmp/pip-install-t3zwxfq6/pycairo/
        Complete output (15 lines):
        running install
        running build
        running build_py
        creating build
        creating build/lib.linux-i686-3.5
        creating build/lib.linux-i686-3.5/cairo
        copying cairo/__init__.py -> build/lib.linux-i686-3.5/cairo
        copying cairo/__init__.pyi -> build/lib.linux-i686-3.5/cairo
        copying cairo/py.typed -> build/lib.linux-i686-3.5/cairo
        running build_ext
        Package cairo was not found in the pkg-config search path.
        Perhaps you should add the directory containing `cairo.pc'
        to the PKG_CONFIG_PATH environment variable
        No package 'cairo' found
        Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']' returned non-zero exit status 1
        ----------------------------------------
    ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-t3zwxfq6/pycairo/setup.py'"'"'; __file__='"'"'/tmp/pip-install-t3zwxfq6/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 /tmp/pip-record-8mfgxfm6/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
  1. 在停用虚拟环境并更改为其他目录后,尝试重复这些步骤。同样的问题。

此时,我很沮丧。我不理解某些错误消息(例如也许您应该添加包含`cairo.pc'的目录)。

使用pip或python3 -m安装库,我从来没有遇到这么多困难或冗长的错误消息。

我想知道是否由于运行32位Linux而出现问题?

pip python-3.5 notify-send
1个回答
0
投票

安装cairo软件包,pycairo只是cairo的接口,不是库本身。检查docs for installation,但其中的一个应该检查:

对于Debian和Debian衍生产品,包括Ubuntu:

sudo apt-get install libcairo2-dev

对于Fedora:

sudo yum install cairo-devel

对于openSUSE:

zypper install cairo-devel
© www.soinside.com 2019 - 2024. All rights reserved.