【问题标题】:How does one do conda (or miniconda) init on a brand new installation?如何在全新安装上执行 conda(或 miniconda)初始化?
【发布时间】:2020-07-08 17:42:02
【问题描述】:

我试图安装 miniconda 并使用它,但我在 Mac Os 上遇到问题。我使用他们的官方安装 dmg (https://docs.conda.io/en/latest/miniconda.html) 并用它来安装 miniconda。它安装在~./opt。然后我做:

conda init bash

它说什么都没有改变:

(base) brandBrandoParetoopareto~/automl-meta-learning $ conda init bash
no change     /Users/brandBrandoParetoopareto/opt/miniconda3/condabin/conda
no change     /Users/brandBrandoParetoopareto/opt/miniconda3/bin/conda
no change     /Users/brandBrandoParetoopareto/opt/miniconda3/bin/conda-env
no change     /Users/brandBrandoParetoopareto/opt/miniconda3/bin/activate
no change     /Users/brandBrandoParetoopareto/opt/miniconda3/bin/deactivate
no change     /Users/brandBrandoParetoopareto/opt/miniconda3/etc/profile.d/conda.sh
no change     /Users/brandBrandoParetoopareto/opt/miniconda3/etc/fish/conf.d/conda.fish
no change     /Users/brandBrandoParetoopareto/opt/miniconda3/shell/condabin/Conda.psm1
no change     /Users/brandBrandoParetoopareto/opt/miniconda3/shell/condabin/conda-hook.ps1
no change     /Users/brandBrandoParetoopareto/opt/miniconda3/lib/python3.7/site-packages/xontrib/conda.xsh
no change     /Users/brandBrandoParetoopareto/opt/miniconda3/etc/profile.d/conda.csh
no change     /Users/brandBrandoParetoopareto/.bash_profile
No action taken.

但是当我尝试开始一个新的 bash 会话时,它说它们是问题:

(base) brandBrandoParetoopareto~/automl-meta-learning $ bash

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run

    $ conda init <SHELL_NAME>

Currently supported shells are:
  - bash
  - fish
  - tcsh
  - xonsh
  - zsh
  - powershell

See 'conda init --help' for more information and options.

IMPORTANT: You may need to close and restart your shell after running 'conda init'.


brandBrandoParetoopareto~/automl-meta-learning $ 

然后停用我以前的环境。这是为什么呢?


这个 miniconda 肯定有问题,因为当我这样做时:

python script.py

它说有一个语法错误,这意味着它使用了不同版本的 python,尽管我告诉我的环境使用 python3.7 为什么?为什么不用我说的那个版本?


几乎没有细节的相关问题:conda init not initialising new shell

【问题讨论】:

  • 您是否尝试完全关闭您的终端窗口? ==&gt; For changes to take effect, close and re-open your current shell. &lt;==
  • @Pinocchio 我明白了……是因为单独运行bash 不会重新运行.bash_profile?最有可能的。无论如何,conda 的安装仍然在~/opt,它不应该。
  • 一些部分答案:stackoverflow.com/a/60902863/1601580 最终为我修复了它。不知道为什么 conda 一开始就表现得很奇怪,或者一开始就错误地安装了东西……
  • (base) 表示您已经在 Conda 环境中,这意味着 init 应该是不必要的,不是吗?
  • @amc 老实说,我忘记了细节,但我仍然有 conda 版本,尽管我尝试卸载它。我发布的解决方案是从头开始重新启动所有内容后起作用的。

标签: bash macos anaconda


【解决方案1】:

据我所知,最好的办法是不要盲目地信任安装,特别是如果它们修改了您的文件(因为确定它们是否正确更改了您的 bash 代码相当于停止问题)。所以请仔细阅读安装的输出和conda init &lt;Shell&gt;。有关更多详细信息,请参阅:Why is conda init updating my .bash_profile incorrectly?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-11-07
    • 2021-05-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-06
    • 2018-08-14
    相关资源
    最近更新 更多