1. 打开powershell输入命令,找到powershell配置文件
$PROFILE
2. 有conda init加载导致powershell很慢的时候,配置文件如下:
#region conda initialize
# !! Contents within this block are managed by 'conda init' !!
If (Test-Path "D:\tool\Anaconda\Scripts\conda.exe") {
(& "path\to\conda.exe" "shell.powershell" "hook") | Out-String | ?{$_} | Invoke-Expression
}
#endregion
实现conda环境懒加载,只需把内容换成如下即可(此后执行conda activate 环境名
时会自动初始化conda,无需预先加载)
#region conda initialize
# !! Contents within this block are managed by 'conda init' !!
function Load-Conda {
If (Test-Path "path\to\conda.exe") {
(& "D:\tool\Anaconda\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | ?{$_} | Invoke-Expression
}
conda @args
}
Set-Alias conda Load-Conda
#endregion
注意路径,保存后新开一个powershell窗口看效果。
文章评论