问题
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.
回答1:
I also faced the same issue. PATHs 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.
Uninstalled the currently installed Anaconda.
Created folder named
C:\AnacondaPython
for reinstallation of Anaconda.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.
回答2:
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.
来源:https://stackoverflow.com/questions/49142567/conda-not-recognized-as-internal-or-external-after-creating-new-environment