我正在尝试按照本指南在 pycharm 中安装 PyGObject 库 https://pygobject.gnome.org/getting_started.html尝试在 Ubuntu / Debian 部分执行步骤 3:
pip3 install pycairo
这就是返回的内容:
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [48 lines of output]
+ meson setup /tmp/pip-install-9mn9tc6a/pycairo_3bd8575d46fa4c3ba97005887d18ca79 /tmp/pip-install-9mn9tc6a/pycairo_3bd8575d46fa4c3ba97005887d18ca79/.mesonpy-n59ji4fk -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md -Dwheel=true -Dtests=false --native-file=/tmp/pip-install-9mn9tc6a/pycairo_3bd8575d46fa4c3ba97005887d18ca79/.mesonpy-n59ji4fk/meson-python-native-file.ini
The Meson build system
Version: 1.5.2
Source dir: /tmp/pip-install-9mn9tc6a/pycairo_3bd8575d46fa4c3ba97005887d18ca79
Build dir: /tmp/pip-install-9mn9tc6a/pycairo_3bd8575d46fa4c3ba97005887d18ca79/.mesonpy-n59ji4fk
Build type: native build
Project name: pycairo
Project version: 1.27.0
C compiler for the host machine: cc (gcc 11.4.0 "cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0")
C linker for the host machine: cc ld.bfd 2.38
Host machine cpu family: x86_64
Host machine cpu: x86_64
Program python3 found: YES (/home/demerf/PycharmProjects/gtkgtk/.venv/bin/python)
Compiler for C supports arguments -Wall: YES
Compiler for C supports arguments -Warray-bounds: YES
Compiler for C supports arguments -Wcast-align: YES
Compiler for C supports arguments -Wconversion: YES
Compiler for C supports arguments -Wextra: YES
Compiler for C supports arguments -Wformat=2: YES
Compiler for C supports arguments -Wformat-nonliteral: YES
Compiler for C supports arguments -Wformat-security: YES
Compiler for C supports arguments -Wimplicit-function-declaration: YES
Compiler for C supports arguments -Winit-self: YES
Compiler for C supports arguments -Winline: YES
Compiler for C supports arguments -Wmissing-format-attribute: YES
Compiler for C supports arguments -Wmissing-noreturn: YES
Compiler for C supports arguments -Wnested-externs: YES
Compiler for C supports arguments -Wold-style-definition: YES
Compiler for C supports arguments -Wpacked: YES
Compiler for C supports arguments -Wpointer-arith: YES
Compiler for C supports arguments -Wreturn-type: YES
Compiler for C supports arguments -Wshadow: YES
Compiler for C supports arguments -Wsign-compare: YES
Compiler for C supports arguments -Wstrict-aliasing: YES
Compiler for C supports arguments -Wundef: YES
Compiler for C supports arguments -Wunused-but-set-variable: YES
Compiler for C supports arguments -Wswitch-default: YES
Compiler for C supports arguments -Wno-missing-field-initializers: YES
Compiler for C supports arguments -Wno-unused-parameter: YES
Compiler for C supports arguments -fno-strict-aliasing: YES
Compiler for C supports arguments -fvisibility=hidden: YES
Found pkg-config: YES (/usr/bin/pkg-config) 0.29.2
Run-time dependency cairo found: YES 1.16.0
Run-time dependency python found: NO (tried pkgconfig, pkgconfig and sysconfig)
../cairo/meson.build:51:15: ERROR: Python dependency not found
A full log can be found at /tmp/pip-install-9mn9tc6a/pycairo_3bd8575d46fa4c3ba97005887d18ca79/.mesonpy-n59ji4fk/meson-logs/meson-log.txt
[end of output]
我正在运行 Ubuntu 22.04.5 LTS 和 python 3.12,对 Linux 系统非常不熟悉,日志文件位于
/tmp/pip-install-9mn9tc6a/pycairo_3bd8575d46fa4c3ba97005887d18ca79/.mesonpy-n59ji4fk/meson-logs/meson-log.txt
找不到。尝试执行步骤 4 也会返回类似的错误。
除非你需要新版本的 Ubuntu 将其打包:
sudo apt install python3-gi