对于Linux Mint 18.3 32位和Python 3.5.2以及Python3虚拟环境。
我在安装Python 3的通知发送时遇到问题。目的是在“通知气泡” ala中显示文本:
我已经有一个BASH脚本可以满足我的要求。我希望直接在Python3中复制它,而不是求助于调用BASH的notify-send命令行实例的子进程。
我为Python 3虚拟环境创建了一个文件夹,在该文件夹中,使用python3 -m venv gui_experiments
创建了虚拟环境,然后使用source env/gui_experiments/activate
激活了该虚拟端口。收到表征活跃静脉的提示...
在该虚拟环境中, pip 告诉我应该升级pip。升级版本已经存在于虚拟环境之外,但不存在于虚拟环境中。在venv中,我尝试使用pip建议的命令行-sudo -H pip install --upgrade pip
-pip通知我已经安装了最新版本。为了打破 upgrade->已经安装循环,我改用python3 -m pip3 install --upgrade pip3
强制pip升级到版本19.3.1(截至当前日期)。
pip search notify-send | grep ^notify-send
返回:
通知发送(0.0.13)
键入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 $
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.
这时我很沮丧。我不理解某些错误消息(例如也许您应该添加包含`cairo.pc'的目录)。
使用pip或python3 -m
安装库,我从来没有遇到这么多困难或冗长的错误消息。
我想知道是否由于运行32位Linux而出现问题?
答案 0 :(得分:0)
安装id = int(ids[counter])
软件包,cairo
只是pycairo
的接口,不是库本身。检查docs for installation,但应执行以下操作:
对于Debian和Debian衍生产品,包括Ubuntu:
cairo
对于Fedora:
sudo apt-get install libcairo2-dev
对于openSUSE:
sudo yum install cairo-devel