为什么要用mambaforge?

Anaconda 臃肿,

下载

conda-forge/miniforge: A conda-forge distribution. (github.com)

1
wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Windows-x86_64.exe

配置

mamba init:~/.bash_profile添加

1
2
3
4
5
6
7
8


eval "$('/c/Users/Achuan-2/mambaforge/Scripts/conda.exe' 'shell.bash' 'hook')"

if [ -f "/c/Users/Achuan-2/mambaforge/etc/profile.d/mamba.sh" ]; then
. "/c/Users/Achuan-2/mambaforge/etc/profile.d/mamba.sh"
fi

新建个人环境

新建个人环境,base环境不装东西

1
conda create -n achuan --clone base

安装基础包:vim equirements.txt

1
2
3
4
5
6
7
8
9
10
11
12
autopep8
numpy
pandas
tqdm
pandas
matplotlib
Pillow
seaborn
ipympl
ipykernel
scikit-image
jupyterlab

安装

1
mamba install --yes --file requirements.txt

配置镜像

vim ~/.condarc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

conda config



conda config --add channels bioconda
#conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
#conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/


conda config --get channels


conda config --set show_channel_urls yes

#恢复默认镜像
conda config --remove-key channels

问题

windows 不支持mamba init,只能用conda activate来切换环境

1
2
'gbk' codec can't decode byte 0xaa in position 347: illegal multibyte sequence
An unexpected error has occurred. Conda has prepared the above report
  • 解决方法

    C:\Users\Achuan-2\mambaforge\Lib\site-packages\mamba\mamba_shell_init.py

    1
    2
    - 35 with open(file, "r") as fi:
    + 35 with open(file, "r",encoding="utf-8") as fi: