xiaojin093 2026-04-08 15:07 采纳率: 14.5%
浏览 3

WatermarkRemover-AI windows安装使用


PS D:\bxj\TEST\WatermarkRemover-AI> pip install -r requirements.txt
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu124
Collecting torch>=2.4.0 (from -r requirements.txt (line 3))
  Using cached torch-2.8.0-cp39-cp39-win_amd64.whl.metadata (30 kB)
Collecting torchvision>=0.19.0 (from -r requirements.txt (line 4))
  Using cached torchvision-0.23.0-cp39-cp39-win_amd64.whl.metadata (6.1 kB)
Collecting transformers>=4.50.0 (from -r requirements.txt (line 5))
  Using cached transformers-4.57.6-py3-none-any.whl.metadata (43 kB)
Collecting diffusers>=0.30.0 (from -r requirements.txt (line 6))
  Using cached diffusers-0.36.0-py3-none-any.whl.metadata (20 kB)
Collecting numpy<2 (from -r requirements.txt (line 7))
  Using cached numpy-1.26.4-cp39-cp39-win_amd64.whl.metadata (61 kB)
Collecting opencv-python-headless<4.12.0,>=4.8.0 (from -r requirements.txt (line 10))
  Using cached opencv_python_headless-4.11.0.86-cp37-abi3-win_amd64.whl.metadata (20 kB)
Collecting Pillow>=10.0.0 (from -r requirements.txt (line 11))
  Using cached pillow-11.3.0-cp39-cp39-win_amd64.whl.metadata (9.2 kB)
Collecting pywebview>=4.0 (from -r requirements.txt (line 16))
  Using cached pywebview-6.1-py3-none-any.whl.metadata (4.7 kB)
Collecting loguru (from -r requirements.txt (line 19))
  Using cached loguru-0.7.3-py3-none-any.whl.metadata (22 kB)
Collecting click (from -r requirements.txt (line 20))
  Using cached click-8.1.8-py3-none-any.whl.metadata (2.3 kB)
Collecting tqdm (from -r requirements.txt (line 21))
  Using cached tqdm-4.67.3-py3-none-any.whl.metadata (57 kB)
Collecting psutil (from -r requirements.txt (line 22))
  Using cached psutil-7.2.2-cp37-abi3-win_amd64.whl.metadata (22 kB)
Collecting pyyaml (from -r requirements.txt (line 23))
  Using cached pyyaml-6.0.3-cp39-cp39-win_amd64.whl.metadata (2.4 kB)
Collecting PyGObject (from -r requirements.txt (line 26))
  Using cached pygobject-3.54.5.tar.gz (1.3 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [30 lines of output]
      + meson setup C:\Users\Admin\AppData\Local\Temp\pip-install-i4a13d_4\pygobject_0ce83b9cee85463591d6a0a788d9b268 C:\Users\Admin\AppData\Local\Temp\pip-install-i4a13d_4\pygobject_0ce83b9cee85463591d6a0a788d9b268\.mesonpy-izuiwra3 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md -Dtests=false -Dwheel=true --wrap-mode=nofallback --native-file=C:\Users\Admin\AppData\Local\Temp\pip-install-i4a13d_4\pygobject_0ce83b9cee85463591d6a0a788d9b268\.mesonpy-izuiwra3\meson-python-native-file.ini
      The Meson build system
      Version: 1.10.2
      Source dir: C:\Users\Admin\AppData\Local\Temp\pip-install-i4a13d_4\pygobject_0ce83b9cee85463591d6a0a788d9b268
      Build dir: C:\Users\Admin\AppData\Local\Temp\pip-install-i4a13d_4\pygobject_0ce83b9cee85463591d6a0a788d9b268\.mesonpy-izuiwra3
      Build type: native build
      Activating VS 18.4.3
      Project name: pygobject
      Project version: 3.54.5
      C compiler for the host machine: cl (msvc 19.50.35728 "用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.50.35728 版")
      C linker for the host machine: link link 14.50.35728.0
      Host machine cpu family: x86_64
      Host machine cpu: x86_64
      Program python3 found: YES (C:\Users\Admin\AppData\Local\Programs\Python\Python39\python.exe)
      Run-time dependency python found: YES 3.9
      Did not find pkg-config by name 'pkg-config'
      Found pkg-config: NO
      Found CMake: G:\Program Files\CMake\bin\cmake.EXE (4.3.1)
      WARNING: Unknown generator expression '$<CONFIG:Debug>'.
      WARNING: Unknown generator expression '$<:Debug>'.
      WARNING: Unknown generator expression '$<CONFIG:Debug,RelWithDebInfo>'.
      WARNING: Unknown generator expression '$<:ProgramDatabase>'.
      WARNING: Unknown generator expression '$<:StackFrameErrorCheck;UninitializedVariable>'.
      Run-time dependency girepository-2.0 found: NO (tried pkgconfig and cmake)
      Not looking for a fallback subproject for the dependency girepository-2.0 because:
      Use of fallback dependencies is disabled.

      ..\meson.build:31:9: ERROR: Dependency 'girepository-2.0' is required but not found.

      A full log can be found at C:\Users\Admin\AppData\Local\Temp\pip-install-i4a13d_4\pygobject_0ce83b9cee85463591d6a0a788d9b268\.mesonpy-izuiwra3\meson-logs\meson-log.txt
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> PyGObject

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
PS D:\bxj\TEST\WatermarkRemover-AI>
  • 写回答

2条回答 默认 最新

  • 檀越@新空间 2026-04-08 15:08
    关注

    下午好🌅🌅🌅
    本答案参考通义千问

    在安装 PyGObject 时出现的错误表明 依赖项未正确安装或配置,特别是 pkg-config 和构建工具链(如 Meson、CMake)。以下是详细的解决方案:


    解决步骤:

    1. 安装 pkg-config

      • PyGObject 需要 pkg-config 来查找 GObject 的依赖项。
      • 下载并安装 pkg-config(选择 Windows 版本)。
      • 安装完成后,将 pkg-config 的路径添加到系统环境变量 PATH 中。
    2. 安装 CMake 和 Visual Studio Build Tools

      • PyGObject 的构建需要 CMake 和 Microsoft Visual Studio 构建工具。
      • 安装 CMake(推荐最新版本)。
      • 安装 Visual Studio Build Tools(选择“C++ 构建工具”)。
    3. 设置环境变量

      • 确保以下路径已加入系统环境变量 PATH
        • C:\Program Files\CMake\bin
        • C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin
        • pkg-config 的安装目录(例如 C:\Program Files\pkg-config\bin
    4. 重新运行安装命令

      • 在 PowerShell 中执行以下命令:
        pip install -r requirements.txt
        
    5. 如果仍然失败,尝试手动安装 PyGObject

      • 手动下载 PyGObject.whl 文件(可从 PyPI 获取)。
      • 使用以下命令安装:
        pip install pygobject-3.54.5-cp39-none-win_amd64.whl
        

    📌 重点提示:

    • 确保所有依赖项(如 pkg-config、CMake、MSVC 工具链)都已正确安装和配置
    • 避免使用非官方源或不兼容的版本,这可能导致构建失败。
    • 如果问题仍未解决,请检查 Python 版本是否与 PyGObject 兼容(通常支持 Python 3.7 及以上)。

    🔧 修改后的代码示例(如果需要):

    如果你无法直接安装 PyGObject,可以考虑以下替代方案:

    # 替代方案:使用其他 GUI 框架(如 PyQt 或 Tkinter)
    from PyQt5.QtWidgets import QApplication, QLabel, QWidget
    
    app = QApplication([])
    window = QWidget()
    window.setWindowTitle("WatermarkRemover-AI")
    window.show()
    app.exec_()
    

    🧠 总结:

    | 步骤 | 内容 | |------|------| | 1 | 安装 pkg-config 并将其加入系统环境变量 | | 2 | 安装 CMake 和 Visual Studio Build Tools | | 3 | 设置环境变量以包含上述工具的路径 | | 4 | 重新运行 pip install -r requirements.txt | | 5 | 如果仍失败,尝试手动安装 PyGObject |

    通过以上步骤,应该能够成功安装 PyGObject 并继续使用 WatermarkRemover-AI

    评论

报告相同问题?

问题事件

  • 创建了问题 4月8日