【AI Agent 项目 SUNA 部署】Windows 全版本 GTK 兼容与部署最佳实践(兼顾 Frontend 前端 和 Backend 后端 顺利部署)
新方案通过环境变量使得系统能够识别 MSYS2 提供的 GTK 动态库,从而不再强制使用 MSYS2 的 Python。结合 Poetry 虚拟环境,可以灵活选择 Python 版本并快速进行依赖管理,更加适合现代 Python 开发者在 Windows 上开发和部署基于 GTK 的前端应用。强烈推荐开发者使用此方案,尤其适用于部署 AI Agent 项目 SUNA、需要在 Windows 上同时
1. 项目背景
在 SUNA 项目的本地部署过程中,尤其是在 Windows 平台下,前端界面需要依赖 GTK 图形库。然而,GTK 的跨平台支持在 Windows 上并不完善,尤其涉及 Python 的调用时,经常会因为路径、环境变量、兼容性等问题而导致运行失败。
本笔记总结并对比了两种解决方案,最终提出了一种更加灵活、现代、推荐的方式,以支持更高版本的 Python 和使用 Poetry 虚拟环境完成完整部署。
2. 原有方案回顾(MSYS2 自带 Python)
【笔记】离个大谱!彻底解决Windows系统部署开源AI Agent项目SUNA的Frontend前端安装GTK库的问题_suna本地部署-CSDN博客
❌ 方案说明
-
安装 MSYS2,使用其提供的
pacman
包管理工具安装 GTK 相关库。 -
同时,使用 MSYS2 自带的 Python(版本通常为 3.10 或更低)来运行整个项目。
-
所有虚拟环境、依赖安装、前后端启动都在 MSYS2 环境中完成。
⚠️ 存在问题
-
Python 版本和功能限定,无法很顺畅安装某些现代 AI 框架库(如tokenizers、pandas、numpy、Pillow、maturin)。
-
环境耦合严重,不利于使用主流虚拟环境管理工具如 Poetry。
-
需合作使用 MSYS2 shell 统一安装兼容的工具链,不符合日常 Windows 开发习惯。
3. 新方案详解(推荐)
✅ 目标
-
在 Windows 上构建一个能兼容 GTK 前端的 Python 环境。
-
允许使用任意 Python >=3.11(<3.13),可通过 Poetry 管理 SUNA 项目。
-
不再依赖 MSYS2 自带 Python,只使用其提供的 GTK 动态链接库。
☑️ 步骤如下:
Step 1: 安装 MSYS2 并安装 GTK3 库
# 进入 MSYS2 shell
pacman -Syu
pacman -S mingw-w64-x86_64-gtk3
# 验证
pkg-config --modversion gtk+-3.0
Step 2: 配置系统环境变量
进入 Windows 系统环境变量设置:
-
添加新变量名:
GTK_BASEPATH
-
变量值:
D:\msys64\mingw64
#添加新变量名:
GTK_BASEPATH
#变量值:
D:\msys64\mingw64
注意:请根据你本机 MSYS2 安装路径适当调整。
Step 3: 添加 GTK 到 PATH 路径
可选方式(自动或手动):
-
手动添加到系统 PATH 中:
%GTK_BASEPATH%\bin
Step 4: 使用任意 Python + Poetry 安装依赖
通过安装命令,再次确认当前环境的 poetry 安装(可选)
pip install poetry
预期输出:
Microsoft Windows [Version 10.0.27871.1000]
(c) Microsoft Corporation. All rights reserved.
(suna-py3.12) F:\PythonProjects\suna>pip install poetry
Collecting poetry
Using cached poetry-2.1.3-py3-none-any.whl.metadata (7.1 kB)
Collecting build<2.0.0,>=1.2.1 (from poetry)
Using cached build-1.2.2.post1-py3-none-any.whl.metadata (6.5 kB)
Collecting cachecontrol<0.15.0,>=0.14.0 (from cachecontrol[filecache]<0.15.0,>=0.14.0->poetry)
Using cached cachecontrol-0.14.3-py3-none-any.whl.metadata (3.1 kB)
Collecting cleo<3.0.0,>=2.1.0 (from poetry)
Using cached cleo-2.1.0-py3-none-any.whl.metadata (12 kB)
Collecting dulwich<0.23.0,>=0.22.6 (from poetry)
Downloading dulwich-0.22.8-cp312-cp312-win_amd64.whl.metadata (5.1 kB)
Collecting fastjsonschema<3.0.0,>=2.18.0 (from poetry)
Using cached fastjsonschema-2.21.1-py3-none-any.whl.metadata (2.2 kB)
Collecting findpython<0.7.0,>=0.6.2 (from poetry)
Using cached findpython-0.6.3-py3-none-any.whl.metadata (5.3 kB)
Collecting installer<0.8.0,>=0.7.0 (from poetry)
Using cached installer-0.7.0-py3-none-any.whl.metadata (936 bytes)
Collecting keyring<26.0.0,>=25.1.0 (from poetry)
Using cached keyring-25.6.0-py3-none-any.whl.metadata (20 kB)
Collecting packaging>=24.0 (from poetry)
Using cached packaging-25.0-py3-none-any.whl.metadata (3.3 kB)
Collecting pbs-installer<2026.0.0,>=2025.1.6 (from pbs-installer[download,install]<2026.0.0,>=2025.1.6->poetry)
Using cached pbs_installer-2025.6.6-py3-none-any.whl.metadata (990 bytes)
Collecting pkginfo<2.0,>=1.12 (from poetry)
Using cached pkginfo-1.12.1.2-py3-none-any.whl.metadata (13 kB)
Collecting platformdirs<5,>=3.0.0 (from poetry)
Using cached platformdirs-4.3.8-py3-none-any.whl.metadata (12 kB)
Collecting poetry-core==2.1.3 (from poetry)
Using cached poetry_core-2.1.3-py3-none-any.whl.metadata (3.5 kB)
Collecting pyproject-hooks<2.0.0,>=1.0.0 (from poetry)
Using cached pyproject_hooks-1.2.0-py3-none-any.whl.metadata (1.3 kB)
Collecting requests<3.0,>=2.26 (from poetry)
Using cached requests-2.32.3-py3-none-any.whl.metadata (4.6 kB)
Collecting requests-toolbelt<2.0.0,>=1.0.0 (from poetry)
Using cached requests_toolbelt-1.0.0-py2.py3-none-any.whl.metadata (14 kB)
Collecting shellingham<2.0,>=1.5 (from poetry)
Using cached shellingham-1.5.4-py2.py3-none-any.whl.metadata (3.5 kB)
Collecting tomlkit<1.0.0,>=0.11.4 (from poetry)
Using cached tomlkit-0.13.3-py3-none-any.whl.metadata (2.8 kB)
Collecting trove-classifiers>=2022.5.19 (from poetry)
Using cached trove_classifiers-2025.5.9.12-py3-none-any.whl.metadata (2.3 kB)
Collecting virtualenv<21.0.0,>=20.26.6 (from poetry)
Using cached virtualenv-20.31.2-py3-none-any.whl.metadata (4.5 kB)
Collecting colorama (from build<2.0.0,>=1.2.1->poetry)
Using cached colorama-0.4.6-py2.py3-none-any.whl.metadata (17 kB)
Collecting msgpack<2.0.0,>=0.5.2 (from cachecontrol<0.15.0,>=0.14.0->cachecontrol[filecache]<0.15.0,>=0.14.0->poetry)
Downloading msgpack-1.1.0-cp312-cp312-win_amd64.whl.metadata (8.6 kB)
Collecting filelock>=3.8.0 (from cachecontrol[filecache]<0.15.0,>=0.14.0->poetry)
Using cached filelock-3.18.0-py3-none-any.whl.metadata (2.9 kB)
Collecting crashtest<0.5.0,>=0.4.1 (from cleo<3.0.0,>=2.1.0->poetry)
Using cached crashtest-0.4.1-py3-none-any.whl.metadata (1.1 kB)
Collecting rapidfuzz<4.0.0,>=3.0.0 (from cleo<3.0.0,>=2.1.0->poetry)
Downloading rapidfuzz-3.13.0-cp312-cp312-win_amd64.whl.metadata (12 kB)
Collecting urllib3>=1.25 (from dulwich<0.23.0,>=0.22.6->poetry)
Using cached urllib3-2.4.0-py3-none-any.whl.metadata (6.5 kB)
Collecting pywin32-ctypes>=0.2.0 (from keyring<26.0.0,>=25.1.0->poetry)
Using cached pywin32_ctypes-0.2.3-py3-none-any.whl.metadata (3.9 kB)
Collecting jaraco.classes (from keyring<26.0.0,>=25.1.0->poetry)
Using cached jaraco.classes-3.4.0-py3-none-any.whl.metadata (2.6 kB)
Collecting jaraco.functools (from keyring<26.0.0,>=25.1.0->poetry)
Using cached jaraco.functools-4.1.0-py3-none-any.whl.metadata (2.9 kB)
Collecting jaraco.context (from keyring<26.0.0,>=25.1.0->poetry)
Using cached jaraco.context-6.0.1-py3-none-any.whl.metadata (4.1 kB)
Collecting httpx<1,>=0.27.0 (from pbs-installer[download,install]<2026.0.0,>=2025.1.6->poetry)
Using cached httpx-0.28.1-py3-none-any.whl.metadata (7.1 kB)
Collecting zstandard>=0.21.0 (from pbs-installer[download,install]<2026.0.0,>=2025.1.6->poetry)
Downloading zstandard-0.23.0-cp312-cp312-win_amd64.whl.metadata (3.0 kB)
Collecting anyio (from httpx<1,>=0.27.0->pbs-installer[download,install]<2026.0.0,>=2025.1.6->poetry)
Using cached anyio-4.9.0-py3-none-any.whl.metadata (4.7 kB)
Collecting certifi (from httpx<1,>=0.27.0->pbs-installer[download,install]<2026.0.0,>=2025.1.6->poetry)
Using cached certifi-2025.4.26-py3-none-any.whl.metadata (2.5 kB)
Collecting httpcore==1.* (from httpx<1,>=0.27.0->pbs-installer[download,install]<2026.0.0,>=2025.1.6->poetry)
Using cached httpcore-1.0.9-py3-none-any.whl.metadata (21 kB)
Collecting idna (from httpx<1,>=0.27.0->pbs-installer[download,install]<2026.0.0,>=2025.1.6->poetry)
Using cached idna-3.10-py3-none-any.whl.metadata (10 kB)
Collecting h11>=0.16 (from httpcore==1.*->httpx<1,>=0.27.0->pbs-installer[download,install]<2026.0.0,>=2025.1.6->poetry)
Using cached h11-0.16.0-py3-none-any.whl.metadata (8.3 kB)
Collecting charset-normalizer<4,>=2 (from requests<3.0,>=2.26->poetry)
Using cached charset_normalizer-3.4.2-cp312-cp312-win_amd64.whl.metadata (36 kB)
Collecting distlib<1,>=0.3.7 (from virtualenv<21.0.0,>=20.26.6->poetry)
Downloading distlib-0.3.9-py2.py3-none-any.whl.metadata (5.2 kB)
Collecting sniffio>=1.1 (from anyio->httpx<1,>=0.27.0->pbs-installer[download,install]<2026.0.0,>=2025.1.6->poetry)
Using cached sniffio-1.3.1-py3-none-any.whl.metadata (3.9 kB)
Collecting typing_extensions>=4.5 (from anyio->httpx<1,>=0.27.0->pbs-installer[download,install]<2026.0.0,>=2025.1.6->poetry)
Using cached typing_extensions-4.14.0-py3-none-any.whl.metadata (3.0 kB)
Collecting more-itertools (from jaraco.classes->keyring<26.0.0,>=25.1.0->poetry)
Downloading more_itertools-10.7.0-py3-none-any.whl.metadata (37 kB)
Downloading poetry-2.1.3-py3-none-any.whl (278 kB)
Downloading poetry_core-2.1.3-py3-none-any.whl (332 kB)
Downloading build-1.2.2.post1-py3-none-any.whl (22 kB)
Downloading cachecontrol-0.14.3-py3-none-any.whl (21 kB)
Downloading cleo-2.1.0-py3-none-any.whl (78 kB)
Downloading crashtest-0.4.1-py3-none-any.whl (7.6 kB)
Downloading dulwich-0.22.8-cp312-cp312-win_amd64.whl (608 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 608.7/608.7 kB 443.7 kB/s eta 0:00:00
Downloading fastjsonschema-2.21.1-py3-none-any.whl (23 kB)
Downloading findpython-0.6.3-py3-none-any.whl (20 kB)
Downloading installer-0.7.0-py3-none-any.whl (453 kB)
Downloading keyring-25.6.0-py3-none-any.whl (39 kB)
Downloading msgpack-1.1.0-cp312-cp312-win_amd64.whl (75 kB)
Downloading pbs_installer-2025.6.6-py3-none-any.whl (58 kB)
Using cached httpx-0.28.1-py3-none-any.whl (73 kB)
Using cached httpcore-1.0.9-py3-none-any.whl (78 kB)
Downloading pkginfo-1.12.1.2-py3-none-any.whl (32 kB)
Using cached platformdirs-4.3.8-py3-none-any.whl (18 kB)
Downloading pyproject_hooks-1.2.0-py3-none-any.whl (10 kB)
Downloading rapidfuzz-3.13.0-cp312-cp312-win_amd64.whl (1.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 168.4 kB/s eta 0:00:00
Using cached requests-2.32.3-py3-none-any.whl (64 kB)
Using cached charset_normalizer-3.4.2-cp312-cp312-win_amd64.whl (105 kB)
Using cached idna-3.10-py3-none-any.whl (70 kB)
Downloading requests_toolbelt-1.0.0-py2.py3-none-any.whl (54 kB)
Downloading shellingham-1.5.4-py2.py3-none-any.whl (9.8 kB)
Downloading tomlkit-0.13.3-py3-none-any.whl (38 kB)
Using cached urllib3-2.4.0-py3-none-any.whl (128 kB)
Downloading virtualenv-20.31.2-py3-none-any.whl (6.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.1/6.1 MB 939.1 kB/s eta 0:00:00
Downloading distlib-0.3.9-py2.py3-none-any.whl (468 kB)
Using cached filelock-3.18.0-py3-none-any.whl (16 kB)
Using cached certifi-2025.4.26-py3-none-any.whl (159 kB)
Using cached h11-0.16.0-py3-none-any.whl (37 kB)
Using cached packaging-25.0-py3-none-any.whl (66 kB)
Downloading pywin32_ctypes-0.2.3-py3-none-any.whl (30 kB)
Using cached trove_classifiers-2025.5.9.12-py3-none-any.whl (14 kB)
Downloading zstandard-0.23.0-cp312-cp312-win_amd64.whl (495 kB)
Using cached anyio-4.9.0-py3-none-any.whl (100 kB)
Using cached sniffio-1.3.1-py3-none-any.whl (10 kB)
Using cached typing_extensions-4.14.0-py3-none-any.whl (43 kB)
Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Downloading jaraco.classes-3.4.0-py3-none-any.whl (6.8 kB)
Downloading jaraco.context-6.0.1-py3-none-any.whl (6.8 kB)
Downloading jaraco.functools-4.1.0-py3-none-any.whl (10 kB)
Downloading more_itertools-10.7.0-py3-none-any.whl (65 kB)
Installing collected packages: trove-classifiers, fastjsonschema, distlib, zstandard, urllib3, typing_extensions, tomlkit, sniffio, shellingham, rapidfuzz, pywin32-ctypes, pyproject-hooks, poetry-core, platformdirs, pkginfo, pbs-installer, packaging, msgpack, more-itertools, jaraco.context, installer, idna, h11, filelock, crashtest, colorama, charset-normalizer, certifi, virtualenv, requests, jaraco.functools, jaraco.classes, httpcore, findpython, dulwich, cleo, build, anyio, requests-toolbelt, keyring, httpx, cachecontrol, poetry
Successfully installed anyio-4.9.0 build-1.2.2.post1 cachecontrol-0.14.3 certifi-2025.4.26 charset-normalizer-3.4.2 cleo-2.1.0 colorama-0.4.6 crashtest-0.4.1 distlib-0.3.9 dulwich-0.22.8 fastjsonschema-2.21.1 filelock-3.18.0 findpython-0.6.3 h11-0.16.0 httpcore-1.0.9 httpx-0.28.1 idna-3.10 installer-0.7
.0 jaraco.classes-3.4.0 jaraco.context-6.0.1 jaraco.functools-4.1.0 keyring-25.6.0 more-itertools-10.7.0 msgpack-1.1.0 packaging-25.0 pbs-installer-2025.6.6 pkginfo-1.12.1.2 platformdirs-4.3.8 poetry-2.1.3 poetry-core-2.1.3 pyproject-hooks-1.2.0 pywin32-ctypes-0.2.3 rapidfuzz-3.13.0 requests-2.32.3 requests-toolbelt-1.0.0 shellingham-1.5.4 sniffio-1.3.1 tomlkit-0.13.3 trove-classifiers-2025.5.9.12 typing_extensions-4.14.0 urllib3-2.4.0 virtualenv-20.31.2 zstandard-0.23.0
查看poetry版本
poetry -V
查看poetry路径
where poetry
查看python路径
where python
预期输出:
(suna-py3.12) F:\PythonProjects\suna>poetry -V
Poetry (version 2.1.3)
(suna-py3.12) F:\PythonProjects\suna>where poetry
F:\PythonProjects\suna\.venv\Scripts\poetry.exe
D:\ProgramData\anaconda3\Scripts\poetry.exe
D:\msys64\mingw64\bin\poetry.exe
(suna-py3.12) F:\PythonProjects\suna>where python
F:\PythonProjects\suna\.venv\Scripts\python.exe
D:\ProgramData\anaconda3\python.exe
D:\msys64\mingw64\bin\python.exe
Step 5: 启动 SUNA 项目,验证 GTK 调用是否成功
python setup.py '--admin'
预期输出
(suna-py3.12) F:\PythonProjects\suna>python setup.py '--admin'
███████╗██╗ ██╗███╗ ██╗ █████╗
██╔════╝██║ ██║████╗ ██║██╔══██╗
███████╗██║ ██║██╔██╗ ██║███████║
╚════██║██║ ██║██║╚██╗██║██╔══██║
███████║╚██████╔╝██║ ╚████║██║ ██║
╚══════╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝
Setup Wizard
This wizard will guide you through setting up Suna, an open-source generalist AI agent.
Step 8/8: Installing dependencies
==================================================
ℹ️ Installing required dependencies...
ℹ️ Installing frontend dependencies...
up to date in 2s
292 packages are looking for funding
run `npm fund` for details
✅ Frontend dependencies installed successfully
ℹ️ Locking dependencies...
Resolving dependencies... (253.6s)
Writing lock file
ℹ️ Installing backend dependencies...
Installing dependencies from lock file
Package operations: 114 installs, 2 updates, 0 removals
- Installing attrs (25.3.0)
- Downgrading certifi (2025.4.26 -> 2024.2.2)
- Installing frozenlist (1.6.2)
- Installing hpack (4.1.0)
- Installing hyperframe (6.1.0)
- Installing iniconfig (2.1.0)
- Installing multidict (6.4.4)
- Downgrading packaging (25.0 -> 24.1)
- Installing pluggy (1.6.0)
- Installing propcache (0.3.1)
- Installing rpds-py (0.25.1)
- Installing six (1.17.0)
- Installing aiohappyeyeballs (2.6.1)
- Installing aiosignal (1.3.2)
- Installing annotated-types (0.7.0)
- Installing fsspec (2025.5.1)
- Installing h2 (4.2.0)
- Installing jmespath (1.0.1)
- Installing pydantic-core (2.33.2)
- Installing pytest (8.3.3)
- Installing python-dateutil (2.9.0.post0)
- Installing pyyaml (6.0.2)
- Installing referencing (0.36.2)
- Installing setuptools (75.3.0)
- Installing tqdm (4.67.1)
- Installing typing-inspection (0.4.1)
- Installing yarl (1.20.0)
- Installing aiohttp (3.12.10)
- Installing automat (25.4.16)
- Installing botocore (1.38.32)
- Installing click (8.1.7)
- Installing constantly (23.10.4)
- Installing deprecation (2.1.0)
- Installing distro (1.9.0)
- Installing huggingface-hub (0.32.4)
- Installing hyperlink (21.0.0)
- Installing incremental (24.7.2)
- Installing jiter (0.10.0)
- Installing jsonschema-specifications (2025.4.1)
- Installing markupsafe (3.0.2)
- Installing marshmallow (3.26.1)
- Installing numpy (2.3.0)
- Installing protobuf (5.29.5)
- Installing pydantic (2.11.5)
- Installing pyjwt (2.10.1)
- Installing pytest-mock (3.14.1)
- Installing python-dotenv (1.0.1)
- Installing pytz (2025.2)
- Installing regex (2024.11.6)
- Installing starlette (0.36.3)
- Installing strenum (0.4.15)
- Installing tzdata (2025.2)
- Installing wcwidth (0.2.13)
- Installing websockets (14.2)
- Installing wrapt (1.17.2)
- Installing zipp (3.22.0)
- Installing zope-interface (7.2)
- Installing backoff (2.2.1)
- Installing daytona-api-client (0.20.1)
- Installing deprecated (1.2.18)
- Installing dnspython (2.7.0)
- Installing e2b (1.5.1)
- Installing entrypoints (0.4)
- Installing environs (9.5.0)
- Installing fastapi (0.110.0)
- Installing gotrue (2.12.0)
- Installing httpx-sse (0.4.0)
- Installing importlib-metadata (8.7.0)
- Installing jinja2 (3.1.6)
- Installing jsonschema (4.24.0)
- Installing nodeenv (1.9.1)
- Installing openai (1.84.0)
- Installing pandas (2.3.0)
- Installing pillow (10.4.0)
- Installing postgrest (1.0.2)
- Installing prometheus-client (0.21.1)
- Installing prompt-toolkit (3.0.36)
- Installing pycryptodomex (3.23.0)
- Installing pydantic-settings (2.9.1)
- Installing python-multipart (0.0.20)
- Installing realtime (2.4.3)
- Installing s3transfer (0.13.0)
- Installing sse-starlette (2.3.6)
- Installing storage3 (0.11.3)
- Installing supafunc (0.9.4)
- Installing tiktoken (0.9.0)
- Installing tokenizers (0.21.1)
- Installing toolz (1.0.0)
- Installing twisted (25.5.0)
- Installing uvicorn (0.27.1)
- Installing altair (4.2.2)
- Installing asyncio (3.4.3)
- Installing boto3 (1.38.32)
- Installing daytona-sdk (0.14.0)
- Installing dramatiq (1.18.0)
- Installing e2b-code-interpreter (1.5.1)
- Installing email-validator (2.2.0)
- Installing exa-py (1.14.5)
- Installing langfuse (2.60.8)
- Installing litellm (1.66.1)
- Installing mailtrap (2.1.0)
- Installing mcp (1.9.3)
- Installing nest-asyncio (1.6.0)
- Installing pika (1.3.2)
- Installing prisma (0.15.0)
- Installing pytesseract (0.3.13)
- Installing pytest-asyncio (0.24.0)
- Installing python-ripgrep (0.0.6)
- Installing questionary (2.0.1)
- Installing redis (5.2.1)
- Installing sentry-sdk (2.29.1)
- Installing stripe (12.2.0)
- Installing supabase (2.15.2)
- Installing tavily-python (0.5.4)
- Installing upstash-redis (1.3.0)
- Installing vncdotool (1.2.0)
Installing the current project: suna (1.0)
✅ Backend dependencies installed successfully
ℹ️ Configuring environment files...
✅ Backend .env file created at backend\.env
ℹ️ Redis host is set to: redis
ℹ️ RabbitMQ host is set to: rabbitmq
✅ Frontend .env.local file created at frontend\.env.local
ℹ️ Backend URL is set to: http://localhost:8000/api
Step 8/8: Starting Suna
==================================================
ℹ️ You can start Suna using either Docker Compose or by manually starting the frontend, backend and worker.
How would you like to start Suna?
[1] Docker Compose (recommended, starts all services)
[2] Manual startup (requires Redis, RabbitMQ & separate terminals)
Enter your choice (1 or 2): 1
ℹ️ Starting Suna with Docker Compose...
ℹ️ Building images locally...
Compose can now delegate builds to bake for better performance.
To do so, set COMPOSE_BAKE=true.
[+] Building 1.4s (2/2) FINISHED docker:desktop-linux
=> [worker internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 1.63kB
从输出中可以看到
Frontend 前端:
✅ Frontend dependencies installed successfully
前端依赖项安装成功(GTK库的问题已解决)
Backend 后端:
✅ Backend dependencies installed successfully
后端依赖项安装成功(现代 AI 框架库问题已解决)
4. 新旧方案对比
比较项 | 旧方案(MSYS2 Python) | 新方案(任意 Python + GTK_BASEPATH) |
---|---|---|
Python 版本 | 受限(通常 =3.12) | 灵活(如 3.11、3.12) |
环境隔离性 | 差,耦合于 MSYS2 shell | 高,可与各版本Python配合使用 Poetry |
安装复杂度 | 高 | 中等 |
前后端集成 | 可行但局限 | 模块化、现代 |
推荐程度 | ❌ | ⭐ ⭐ ⭐ ⭐ ⭐ |

5. 总结与建议
新方案通过环境变量 GTK_BASEPATH
使得系统能够识别 MSYS2 提供的 GTK 动态库,从而不再强制使用 MSYS2 的 Python。结合 Poetry 虚拟环境,可以灵活选择 Python 版本并快速进行依赖管理,更加适合现代 Python 开发者在 Windows 上开发和部署基于 GTK 的前端应用。
强烈推荐开发者使用此方案,尤其适用于部署 AI Agent 项目 SUNA、需要在 Windows 上同时完成前后端运行测试的场景。
如需进一步定制此环境或集成 CI/CD 脚本部署,也可加入系统 PATH、在 VSCode 中配置
.env
文件来自动识别 GTK。

GitCode 天启AI是一款由 GitCode 团队打造的智能助手,基于先进的LLM(大语言模型)与多智能体 Agent 技术构建,致力于为用户提供高效、智能、多模态的创作与开发支持。它不仅支持自然语言对话,还具备处理文件、生成 PPT、撰写分析报告、开发 Web 应用等多项能力,真正做到“一句话,让 Al帮你完成复杂任务”。
更多推荐
所有评论(0)