235 字
1 分钟
解决linux中shell加载速度慢(conda启动速度慢)
最近终端启动速度突然变慢,要等很久才能弹出输入框。
经过排查是conda加载环境耗费了较多的时间。
参考网上大神的思路,将conda设置为lazy load解决了这个问题。
我的终端使用fish,修改~/.config/fish/config.fish
# Uses the first conda installation found in the following listset -x CONDA_PATH $HOME/miniconda3/bin/conda /data/miniconda3/bin/conda
function conda echo "Lazy loading conda upon first invocation..." functions --erase conda for conda_path in $CONDA_PATH if test -f $conda_path echo "Using Conda installation found in $conda_path" eval $conda_path "shell.fish" "hook" | source conda $argv return end end echo "No conda installation found in $CONDA_PATH"end
# (c)hancge (e)nvironment with condafunction ce conda activate (conda info --envs | fzf | awk '{print $1}')end# # >>> conda initialize >>># # !! Contents within this block are managed by 'conda init' !!# if test -f /home/fang/miniconda3/bin/conda# eval /home/fang/miniconda3/bin/conda "shell.fish" "hook" $argv | source# else# if test -f "/home/fang/miniconda3/etc/fish/conf.d/conda.fish"# . "/home/fang/miniconda3/etc/fish/conf.d/conda.fish"# else# set -x PATH "/home/fang/miniconda3/bin" $PATH# end# end# # <<< conda initialize <<<WARNING好吧有一定的副作用,codex等ai工具找不到conda环境了
解决linux中shell加载速度慢(conda启动速度慢)
https://blog.zyfang.top/posts/linuxs/conda/修复conda启动慢的问题/