简体   繁体   中英

Conda not recognized as internal or external after creating new environment

conda command was working fine from Anaconda prompt. I created a new environment for tensorflow after which it says - 'conda' is not recognized as an internal or external command,operable program or batch file.

I have checked all my PATH variables, and root, scripts and lib folder paths are added to the PATH .

It just does not recognize any commands - conda, activate, deactivate, any of these.

It happened to me as well. I created a new env and was able to switch to the new env using command conda activate . But once I was in the new env I was not able to use conda command at all, even to deactivate the env.

I just opened a new WIN's command prompt then switched to the new env and then was able to use conda command with no issues.

I also faced the same issue. PATH s were also fine but I was unable to execute the conda command.

While installing Anaconda , I had checked ADD TO PATH option, I think that created problem.

Anaconda does not recommend to do this. You can see RED colored warning if you check the ADD TO PATH check box.

See the below 2 images.

Before checking the box

在此处输入图片说明

After checking the box

在此处输入图片说明

Finally I reinstalled the Anaconda without checking the check box ADD TO PATH then manually set the PATH .

Better is to use your own custom location for Anaconda installation as I did.

I do not know, in which system you are working. I am windows user and solved the issue as follows.

  1. Uninstalled the currently installed Anaconda .

  2. Created folder named C:\\AnacondaPython for reinstallation of Anaconda .

  3. Manually added the following 5 PATHS to PATH environment variable.

    C:\\AnacondaPython

    C:\\AnacondaPython\\Scripts

    C:\\AnacondaPython\\Library

    C:\\AnacondaPython\\Library\\mingw-w64\\bin

    C:\\AnacondaPython\\Library\\usr\\bin

Or you can just append the below PATH series.

C:\AnacondaPython;C:\AnacondaPython\Scripts;C:\AnacondaPython\Library;C:\AnacondaPython\Library\mingw-w64\bin;C:\AnacondaPython\Library\usr\bin

So finally, I opened new Terminal , and tried to create, activate & deactivate tensorflow environment.

Please check my Terminal s history that is given below.

(base) C:\Users\sunil kumar>conda create --name tensorflow
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.4.10
  latest version: 4.4.11

Please update conda by running

    $ conda update -n base conda


## Package Plan ##

  environment location: C:\AnacondaPython\envs\tensorflow


Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate tensorflow
#
# To deactivate an active environment, use
#
#     $ conda deactivate


(base) C:\Users\Rishikesh>conda activate tensorflow

(tensorflow) C:\Users\Rishikesh>conda deactivate

(base) C:\Users\Rishikesh>

I will suggest you reinstall your Anaconda to get rid of this issue.

Thanks.

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