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
相关推荐
SmartBrain2 小时前
DeerFlow 实践:华为IPD流程的评审智能体设计
人工智能·语言模型·架构
JoannaJuanCV10 小时前
大语言模型基石:Transformer
人工智能·语言模型·transformer
大千AI助手10 小时前
TruthfulQA:衡量语言模型真实性的基准
人工智能·语言模型·自然语言处理·llm·模型评估·truthfulqa·事实性基准
2501_9151063211 小时前
Xcode 上传 ipa 全流程详解 App Store 上架流程、uni-app 生成 ipa 文件上传与审核指南
android·macos·ios·小程序·uni-app·iphone·xcode
张较瘦_12 小时前
[论文阅读] 人工智能 + 软件工程 | 大语言模型驱动的多来源漏洞影响库识别研究解析
论文阅读·人工智能·语言模型
什么都想学的阿超12 小时前
【大语言模型 58】分布式文件系统:训练数据高效存储
人工智能·语言模型·自然语言处理
J_Xiong011713 小时前
【VLMs篇】07:Open-Qwen2VL:在学术资源上对完全开放的多模态大语言模型进行计算高效的预训练
人工智能·语言模型·自然语言处理
他们都不看好你,偏偏你最不争气14 小时前
【iOS】AFNetworking
开发语言·macos·ios·objective-c
艾醒(AiXing-w)14 小时前
探索大语言模型(LLM):Ollama快速安装部署及使用(含Linux环境下离线安装)
linux·人工智能·语言模型
这张生成的图像能检测吗16 小时前
(综述)视觉任务的视觉语言模型
人工智能·计算机视觉·语言模型·自然语言处理·视觉语言模型