powershell conda报错

问题描述:

安装anaconda或conda后,由于变更环境后导致文件配置出错。出现打开powershell出现报错

usage: anaconda [-h] [--disable-ssl-warnings] [--show-traceback] [-v] [-q]
                [-V] [-t TOKEN] [-s SITE]
                ...
anaconda: error: argument : invalid choice: 'shell.powershell' (choose from 'auth', 'label', 'channel', 'config', 'copy', 'download', 'groups', 'login', 'logout', 'move', 'notebook', 'package', 'remove', 'search', 'show', 'update', 'upload', 'whoami')
Invoke-Expression : 无法将参数绑定到参数“Command”,因为该参数为空字符串。
所在位置 C:\Users\Jimmy\Documents\WindowsPowerShell\profile.ps1:3 字符: 81
+ ... onda.exe" "shell.powershell" "hook") | Out-String | Invoke-Expression
+                                                         ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:PSObject) [Invoke-Expression],ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.Invo
   keExpressionCommand

加载个人及系统配置文件用了 1551 毫秒。

原因分析&解决

打开:C:\Users\Jimmy\Documents\WindowsPowerShell\profile.ps1

#region conda initialize
# !! Contents within this block are managed by 'conda init' !!
(& "F:\anaconda\Scripts\anaconda.exe" "shell.powershell" "hook") | Out-String | Invoke-Expression
#endregion

这个是powershell的conda位置配置,借鉴他人两种方法尝试解决,分别是修改profile.ps1"F:\anaconda\Scripts\anaconda.exe的文件位置和删除用户的系统变量。尝试后没有改善。由于暂时不需要使用conda,删除profile.ps1后即可。

你可能感兴趣的:(运维,windows)