Mac上安装运行SynthTIGER

1. 确保已安装 Python 环境

SynthTIGER 需要 Python 3.6+。如果你的 Mac 没有安装 Python:

验证安装:

复制代码
python3 --version
pip3 --version

2. 安装 SynthTIGER

通过 pip 安装 SynthTIGER:

复制代码
pip3 install synthtiger

(如果需要特定版本,可以指定版本号,如 pip3 install synthtiger==1.x.x


3. 验证安装

运行以下命令检查是否安装成功:

复制代码
python3 -c "import synthtiger; print(synthtiger.__version__)"

如果没有报错并显示版本号,说明安装成功。

  1. 常见问题

1.pip3 install synthtiger error: externally-managed-environment 错误

复制代码
pip3 install synthtiger error: externally-managed-environment × This environment is externally managed ╰─> To install Python packages system-wide, try brew install xyz, where xyz is the package you are trying to install.

这个错误是因为你的 macOS 系统(尤其是较新版本的 macOS,如 Ventura 或 Sonoma)默认使用 "externally-managed-environment" 机制,防止用户直接通过 pip 全局安装 Python 包,以避免与系统自带的 Python 冲突。

最佳实践是创建一个独立的 Python 虚拟环境(Virtual Environment):

复制代码
# 创建虚拟环境
python3 -m venv ~/synthtiger-env

# 激活虚拟环境
source ~/synthtiger-env/bin/activate

# 安装 SynthTIGER
pip install synthtiger

之后,每次运行 SynthTIGER 前,先激活虚拟环境:

复制代码
source ~/synthtiger-env/bin/activate
复制代码
2. AttributeError: `np.sctypes` was removed in the NumPy 2.0 release. Access dtypes explicitly instead. 错误
复制代码
python3 -c "import synthtiger; print(synthtiger.__version__)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import synthtiger; print(synthtiger.__version__)
    ^^^^^^^^^^^^^^^^^
  File "/synthtiger-env/lib/python3.13/site-packages/synthtiger/__init__.py", line 7, in <module>
    from synthtiger import components, layers, templates, utils
  File "/synthtiger-env/lib/python3.13/site-packages/synthtiger/components/__init__.py", line 11, in <module>
    from synthtiger.components.image_effect import *
  File "/synthtiger-env/lib/python3.13/site-packages/synthtiger/components/image_effect/__init__.py", line 7, in <module>
    from synthtiger.components.image_effect.additive_gaussian_noise import (
        AdditiveGaussianNoise,
.....
/synthtiger-env/lib/python3.13/site-packages/numpy/__init__.py", line 400, in __getattr__
    raise AttributeError(
    ...<3 lines>...
    )
AttributeError: `np.sctypes` was removed in the NumPy 2.0 release. Access dtypes explicitly instead.

1. 降级 NumPy(推荐)

最直接的解决方法是降级 NumPy 到 1.x 版本(兼容 imgaug):

复制代码
# 在虚拟环境中操作(确保已激活)
source ~/synthtiger-env/bin/activate

# 降级 NumPy
pip install "numpy<2.0" --force-reinstall

# 重新验证
python -c "import synthtiger; print(synthtiger.__version__)"

验证通过:

复制代码
python3 -c "import synthtiger; print(synthtiger.__version__)"
1.2.1
相关推荐
Digitally4 小时前
如何将 iPad 上的视频无损传输到 Mac
macos·音视频·ipad
Maynor9964 小时前
Codex 中国站正式上线!
人工智能·gpt·macos·github
XuecWu35 小时前
【Mac系统】一次 Keychain 异常导致的 Trae 卡死问题排查
macos
秒云6 小时前
MIAOYUN | 每周AI新鲜事儿 260430
人工智能·ai·语言模型·aigc·ai编程
青山_FPGA6 小时前
以太网 MAC-PHY 接口总结
嵌入式硬件·macos
帅次6 小时前
Android AI 面试速刷版
人工智能·深度学习·神经网络·机器学习·语言模型·自然语言处理·数据分析
Zzj_tju7 小时前
大语言模型技术指南:RAG 为什么能补知识盲区?检索、切块、重排与生成参数详解
人工智能·语言模型·自然语言处理
小锋学长生活大爆炸7 小时前
【开源软件】打造 macOS 纯本地 LLM 工作台 | Sidekick
macos·llm
小超同学你好7 小时前
OpenClaw 深度解析与源代码导读 · 第10篇:多 Agent 核心(agents.list、bindings 与隔离边界的可验证机制)
人工智能·深度学习·语言模型·transformer
bleuesprit7 小时前
MAC 电脑快速打开claude code 终端
macos