简体   繁体   中英

Why does '(base)' appear in my anaconda command prompt?

My anaconda command prompt now says:

(base) C:\users\user_name>

I would like to know why (base) appears in front of the prompt. This started appearing since I created a virtual environment to run Django. If I enter 'deactivate' the prompt disappears but if I close the terminal and open a new terminal the 'base' is back again.

(base) C:\users\user_name> deactivate
C:\users\user_name>

The trouble is that this prompt does not recognize pip or any anaconda commands. I can run pip on the 'base' prompt, but not on the original one. I installed a module in '(base)...' using pip but this module is recognized by my ide.

conda list anaconda

in '(base)..' gives th version of Anaconda as 4.4. without the base, it does not recognize conda. I have run pip and conda several times before this happened. I'm running Windows 10.

Try this:

conda config --set auto_activate_base false

The changeps1 only hide the command prompt, you still in this environment.

auto_activate_base can avoid entering the environment.

Although Blockchain Business's answer is correct, as of v 4.6.4

DeprecationWarning: 'source deactivate' is deprecated. Use 'conda deactivate'.

so,

conda deactivate

This actually deactivates Anaconda completely, so may not be the best solution...

To restore:

 conda activate

如果您在 Ubuntu 中遇到此问题,您可以尝试以下两个步骤将其从命令提示符中删除。

  1. conda config
  2. conda config --set changeps1 False

I had the same issue, I typed the following command to remove the (base) reference:

source deactivate

"(base)" is displayed to tell you which environment you are in. "base" is the default environment.

You can create a new environment from within Anaconda Navigator. You might do this to run a different version of python, perhaps, for example, because a library you wish to use is only compatible with python 3.6 or lower.

Also if you want to install an experimental library/package and not have it break your other installed packages, you might install it in a new environment, where it is isolated from the rest of your installed libraries/packages.

You are probably best to use the Environments tab in Anaconda Navigator for the creation, management of environments and installation of libraries/packages, but you can use the Anaconda Prompt commands if you like and on some machines it is a lot faster to do so.

Be aware that although pip install and conda install commands are supposed to play better together these days, I would still recommend sticking to conda install and only using pip if conda install won't work for a particular package. This is because installing python packages so they do not conflict with one another is apparently not so trivial - and using two different package managers could be a problem. In the old days pip was almost certain to break environments that had been set up with conda or Anaconda Navigator.

It sounds like when you installed Anaconda, it's now seeing that as your default environment, and with Anaconda it's best that you install packages using conda rather than by using pip , because at best pip installed packages won't be recognized by Anaconda, and at worst the pip installed packages can break your Anaconda install. I went through some of this before myself, as I needed to use Anaconda for a Python course I was taking, however I use Kubuntu, so I don't have a lot of knowledge around using it on Windows.

For more info on using Anaconda, see https://conda.io/docs/user-guide/getting-started.html You can probably use Anaconda Navigator to create virtual environments and install packages too.

Showing the active environment in front of the path like (base) C:\\users\\user_name> is a feature, not a bug . If you pip-install a module into the base environment (bad practice warning: Use conda install this_module -c conda-forge or pip install this_module into a separate environment), you'll first need to activate the base environment before you can actually use this_module . If you don't know how to do this in your IDE (although this a base functionallity of any IDE), open a cmd shell, type conda activate and then start your IDE directly from the (base) C:\\users\\user_name> prompt.

In my case, I had run source ~/anaconda3/etc/profile.d/conda.sh and expected the env to get activate.

Instead it must be conda activate

type 'conda deactivate' in the working terminal.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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