首页 > 解决方案 > conda 在 powershell 上激活

问题描述

全新安装 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

我究竟做错了什么?

标签: powershellanaconda

解决方案


结果由于某种原因Continuum/anaconda3/Library/bin没有被添加到我的路径中。添加这个解决了这个问题。

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


推荐阅读