康达在PowerShell上激活

时间:2019-04-09 01:37:12

标签: powershell anaconda

重新安装conda。我正在尝试激活一个环境(任何环境),并且得到以下信息

(base) PS C:\Users\AndrewBergan> conda activate test123

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "C:\Users\AndrewBergan\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\cli\main.py", line 138, in main
        return activator_main()
      File "C:\Users\AndrewBergan\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\activate.py", line 940, in main
        print(activator.execute(), end='')
      File "C:\Users\AndrewBergan\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\activate.py", line 173, in execute
        return getattr(self, self.command)()
      File "C:\Users\AndrewBergan\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\activate.py", line 150, in activate
        builder_result = self.build_activate(self.env_name_or_prefix)
      File "C:\Users\AndrewBergan\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\activate.py", line 275, in build_activate
        return self._build_activate_stack(env_name_or_prefix, False)
      File "C:\Users\AndrewBergan\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\activate.py", line 332, in _build_activate_stack
        self._replace_prefix_in_path(old_conda_prefix, prefix))
      File "C:\Users\AndrewBergan\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\activate.py", line 550, in _replace_prefix_in_path
        assert last_idx is not None
    AssertionError

我在做什么错了?

3 个答案:

答案 0 :(得分:1)

由于某些原因,未将Continuum/anaconda3/Library/bin添加到我的路径中。添加此功能可以解决问题。

编辑: 如以下评论中所述,可能需要对路径进行其他修改。通过添加几个print语句activate.py并比较conda bash窗口和powershell的输出,我能够确定路径中缺少的内容。

答案 1 :(得分:1)

conda开始在4.6版中支持Powershell。升级您的conda,然后运行以下命令:

conda init

那你应该没事。

答案 2 :(得分:0)

您可以使用以下代码更新conda

const x = {
  a: 'a',
  b: 'b',
  d: 'd',
  for: 'for',
};

const {
  a,
  b,
  for: xxx,
  d,
} = x;

console.log({
  a,
  b,
  xxx,
  d
});

因为conda 4.6.14解决了此问题。