简体   繁体   English

Anaconda 不会更新:“无默认基础环境”错误

[英]Anaconda won't update: "No default base environment" error

Issue问题

I've been trying to update my Anaconda installation, but whether I run the updater from the GUI or the Terminal via conda update conda , I receive the error: "NoBaseEnvironmentError: This conda installation has no default base environment."我一直在尝试更新我的 Anaconda 安装,但无论我是从 GUI 还是通过conda update conda update conda 从终端运行更新程序,我都会收到错误消息: "NoBaseEnvironmentError: This conda installation has no default base environment."

I don't understand what is going on here.我不明白这里发生了什么。 I have successfully run Python 2 and 3 scripts on this computer.我已经在这台电脑上成功运行了 Python 2 和 3 个脚本。 Every tutorial I've found assumes a base environment is created by default.我发现的每个教程都假设默认创建一个基本环境。 When I run conda info --envs I see an active environment named "base":当我运行conda info --envs我看到一个名为“base”的活动环境:

# conda environments:
#
base                  *  /Users/MYUSERNAME/anaconda3
ipykernel_py2            /Users/MYUSERNAME/anaconda3/envs/ipykernel_py2
                         /Users/MYUSERNAME/opt/anaconda3

I'm not well-versed in Python or the command line, so I'd appreciate any help in solving this.我不精通 Python 或命令行,所以我很感激任何帮助解决这个问题。 I imagine all I need to do is set the base environment, but after much Googling I cannot figure out how to do so.我想我需要做的就是设置基本环境,但经过大量谷歌搜索后,我无法弄清楚如何去做。 All I want to do is update Anaconda.我想要做的就是更新 Anaconda。

Things I've Tried我尝试过的事情

conda activate prior to running update command conda activate

conda activate base prior to running update command conda activate base

sudo conda update conda

conda update -p /Users/MYUSERNAME/anaconda3 conda

All have resulted in the same error.都导致了同样的错误。

System Details系统详情

I'm running MacOS Catalina 10.15.5 , Conda version 4.7.10我正在运行MacOS Catalina 10.15.5Conda version 4.7.10

conda info output:康达conda info output:

 active environment : base
    active env location : /Users/MYUSERNAME/anaconda3
            shell level : 1
       user config file : /Users/MYUSERNAME/.condarc
 populated config files : /Users/MYUSERNAME/.condarc
          conda version : 4.7.10
    conda-build version : 3.18.8
         python version : 3.7.3.final.0
       virtual packages : 
       base environment : /Users/MYUSERNAME/anaconda3  (read only)
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/MYUSERNAME/anaconda3/pkgs
                          /Users/MYUSERNAME/.conda/pkgs
       envs directories : /Users/MYUSERNAME/.conda/envs
                          /Users/MYUSERNAME/anaconda3/envs
               platform : osx-64
             user-agent : conda/4.7.10 requests/2.22.0 CPython/3.7.3 Darwin/19.5.0 OSX/10.15.5
                UID:GID : 501:20
             netrc file : None
           offline mode : False

conda config --show-sources output: conda config --show-sources output:

==> /Users/MYUSERNAME/.condarc <==
ssl_verify: True
channels:
  - defaults

I never found the solution to this, but resolved the issue by doing a full clean uninstall of Anaconda using the free trial for App Cleaner Uninstaller.我从未找到解决此问题的方法,但通过使用 App Cleaner Uninstaller 的免费试用版完全干净卸载 Anaconda 解决了这个问题。 (I first followed uninstall instructions from two different places and still missed a number of key files.) (我首先按照两个不同地方的卸载说明进行操作,但仍然遗漏了一些关键文件。)

See if there is a file called history in ~/anaconda3/conda-meta/ .查看~/anaconda3/conda-meta/中是否有一个名为history的文件。 If not, create it by writing touch ~/anaconda3/conda-meta/history .如果没有,请通过编写touch ~/anaconda3/conda-meta/history来创建它。

@igor-rivin has already pointed in the direction of this solution in his comment, the post in question is here @igor-rivin 在他的评论中已经指出了这个解决方案的方向,有问题的帖子在这里

You need to restart your shell after installing it.您需要在安装后重新启动 shell。

I had the same issue a few months ago.几个月前我遇到了同样的问题。 I solved the issue by finding the _conda.exe file in the Anaconda3 directory.我通过在 Anaconda3 目录中找到 _conda.exe 文件解决了这个问题。 Today, I was having issues with finding packages and using pip/conda.今天,我在查找包和使用 pip/conda 时遇到了问题。 I ended up uninstalling anaconda and manually deleting all related files.我最终卸载了 anaconda 并手动删除了所有相关文件。

All of this to say, make sure you're operating in the 'Anaconda Prompt' application.综上所述,请确保您在“Anaconda Prompt”应用程序中进行操作。 After running the application, the base environment will be automatically activated.运行应用程序后,基础环境将自动激活。 Note that you will have to run the application as an administrator if you downloaded conda to be used by any user on the PC.请注意,如果您下载了 conda 以供 PC 上的任何用户使用,则必须以管理员身份运行该应用程序。 If you have installed it this way, it will be located in C:\ProgramData\Anaconda3.如果您以这种方式安装它,它将位于 C:\ProgramData\Anaconda3。 I suggest adding this to your environment variables to find it easily next time you go in to manage your packages.我建议将其添加到您的环境变量中,以便下次您在 go 管理您的包时轻松找到它。

You need activate conda enviroment您需要激活 conda 环境

conda activate base

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM