以前整理的,现在 ComfyUI 即将有桌面版,或许用不上了。
1. 配置环境
1.1 Homebrew 安装及配置
国内镜像
直接从国内镜像安装和配置,使用中科大源。
$ /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
$ source ~/.zprofile配置 Terminal 代理
编辑 shell 配置文件,通过设置 http_proxy、https_proxy 让终端走指定的代理。假设代理工具的本地端口为 [port],在配置文件(比如 .zshrc)中添加环境变量
$ ~ nano ~/.zshrcexport http_proxy=http://127.0.0.1:[port]
export https_proxy=$http_proxy
export socks5_proxy="socks5://127.0.0.1:[port]"之后使用 source 命令更改环境变量。
$ source ~/.zshrc这样 Terminal 会一直自动启动代理。
配置好后,安装 git 及 Xcode Command Line Tools:
$ brew install git
$ xcode-select --install1.2 安装和配置 conda
从清华镜像下载 conda 后,配置源镜像:
$ nano ~/.condarc修改内容为:
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
deepmodeling: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/
sse_verify: falseConda 常用命令:
conda --version 查看 conda 版本
conda update conda更新 conda 至最新版conda update --all更新当前环境所有包conda update <package-name>更新当前环境指定软件包conda info --envs查看所有的虚拟环境conda create -n <name> python=<version>创建 python 为指定版本的虚拟环境conda create --name <name2> --clone <name1>复制<name1>虚拟环境并命名为<name2>conda activate <name>激活虚拟环境conda deactivate退出虚拟环境conda remove -n <name1> --all删除名称为<name1>的虚拟环境conda list查看当前虚拟环境所有包情况conda search <package-name>查看指定包有哪些版本conda install <package-name>在当前虚拟环境中安装指定包conda remove <package-name>在当前虚拟环境删除指定包conda config --remove-key channels恢复默认源
1.3 更换国内镜像
pip
直接永久替换即可:
$ pip config set globle.index-url <mirror-url>常用镜像:
- 清华源:
https://pypi.tuna.tsinghua.edu.cn/simple/ - 阿里云:
https://mirrors.aliyun.com/pypi/simple/ - 中国科技大学:
https://pypi.mirrors.ustc.edu.cn/simple - 原始源:
https://pypi.org/simple
node
更换:
$ npm config set registry https://registry.npm.taobao.org验证:
$ npm config get registry2. 安装 Web UI
2.1 安装
$ conda create -n webui python=3.11
$ conda activate webui
$ pip config set globle.index-url https://pypi.tuna.tsinghua.edu.cn/simple/3. 安装 ComfyUI
3.1 安装
$ conda create -n comfyui python=3.11
$ conda activate comfyui
$ pip config set globle.index-url https://pypi.tuna.tsinghua.edu.cn/simple/
$ pip install torch torchvision torchaudio
$ cd ~
$ git clone https://github.com/comfyanonymous/ComfyUI.git
$ cd comfyui
$ pip install -r requirements.txt3.2 打开 comfyui
$ conda activate comfyui #激活conda环境
$ cd ~/comfyui
$ python main.py #运行