我更新后遇到的问题如图。
附解决方法:
1、首先确定环境变量与powershell都配置完毕
2、编辑powershell的配置文件:
notepad $PROFILE
3、将下列代码放到上述文件结尾,注意将conda.exe的文件路径换为自己的安装路径
Write-Host "Running 4th: CurrentUserCurrentHost" -ForegroundColor Magenta
Write-Host "Path: $($PROFILE.CurrentUserCurrentHost)" -ForegroundColor Magenta
# Conda Initialization
(& "D:\anaconda\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | ?{$_} | Invoke-Expression
# Fix for Conda issue in PowerShell 7.5+ (caused by .NET 9 changes)
if ($PSVersionTable.PSVersion -ge [version]"7.5.0") {
$ExecutionContext.InvokeCommand.PreCommandLookupAction = {
param ($CommandName, $CommandOrigin)
if ($CommandName -eq "conda") {
$Env:_CE_M = $null
$Env:_CE_CONDA = $null
}
}
}
如图
4、是配置文件生效:
. $PROFILE
然后问题解决:
原帖:
anaconda - `Invoke-Conda` cannot catch any arguments after powershell 7.5.0 update - Stack Overflow