conda无法激活_windows下conda安装及配置,解决遇到的问题

一、windows下conda安装
1.下载Miniconda


2.安装后配置环境变量
找到自己的安装路径,将下面三个路径添加到环境变量
D:Usersgrfood126miniconda3
D:Usersgrfood126miniconda3Scripts
D:Usersgrfood126miniconda3Librarybin二、conda配置
1.创建环境
D:Usersgrfood126miniconda3Librarybin

>conda create env
1

报错。提示:缺少值,需要一个名字或者前缀

CondaValueError: either -n NAME or -p PREFIX option required,
try "conda create -h" for more details
12

2.新建一个带前缀的环境 new_env

conda create -n new_env
1

3.激活环境

conda activate new_env
1

错误

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

    $ conda init 

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'.
12345678910111213141516

4.根据提示运行conda init
刚开始报错,因为上面的环境变量没有配置完全,只配置了一个D:Usersgrfood126miniconda3
查找了很多网上的错误修改方式,有的说是没有管理员身份运行,有的说是因为之前的虚拟环境没有退出source deactivate。都不行

WARNING: Cannot install xonsh wrapper without a python interpreter in prefix: C:
UsersUser1AppDataLocalTemp_MEI50762
needs sudo    C:UsersUser1AppDataLocalTemp_MEI50762Scriptsconda.exe
needs sudo    C:UsersUser1AppDataLocalTemp_MEI50762Scriptsconda-env.exe
modified      C:UsersUser1AppDataLocalTemp_MEI50762Scriptsconda-script.py
modified      C:UsersUser1AppDataLocalTemp_MEI50762Scriptsconda-env-script.py
needs sudo    C:UsersUser1AppDataLocalTemp_MEI50762condabinconda.bat
needs sudo    C:UsersUser1AppDataLocalTemp_MEI50762Librarybinconda.bat
needs sudo    C:UsersUser1AppDataLocalTemp_MEI50762condabin_conda_activate.bat
needs sudo    C:UsersUser1AppDataLocalTemp_MEI50762condabinrename_tmp.bat
needs sudo    C:UsersUser1AppDataLocalTemp_MEI50762condabinconda_auto_activate.bat
needs sudo    C:UsersUser1AppDataLocalTemp_MEI50762condabinconda_hook.bat
needs sudo    C:UsersUser1AppDataLocalTemp_MEI50762Scriptsactivate.bat
needs sudo    C:UsersUser1AppDataLocalTemp_MEI50762condabinactivate.bat
needs sudo    C:UsersUser1AppDataLocalTemp_MEI50762condabindeactivate.bat
needs sudo    C:UsersUser1AppDataLocalTemp_MEI50762Scriptsactivate
needs sudo    C:UsersUser1AppDataLocalTemp_MEI50762Scriptsdeactivate
needs sudo    C:UsersUser1AppDataLocalTemp_MEI50762etcprofile.dconda.sh

needs sudo    C:UsersUser1AppDataLocalTemp_MEI50762etcfishconf.dconda.fish
needs sudo    C:UsersUser1AppDataLocalTemp_MEI50762shellcondabinConda.psm1
needs sudo    C:UsersUser1AppDataLocalTemp_MEI50762shellcondabinconda-hook.ps1
needs sudo    C:UsersUser1AppDataLocalTemp_MEI50762etcprofile.dconda.csh
modified      HKEY_CURRENT_USERSoftwareMicrosoftCommand ProcessorAutoRun

==> For changes to take effect, close and re-open your current shell. <==
1234567891011121314151617181920212223242526
Operation failed.
1

在用powershell打开Anaconda Prompt (Miniconda3)时发现报错

conda : 无法将“conda”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一 次。
1

网上搜索问题后,发现配置conda时不止需要添加一个环境变量,修改环境变量后,conda init正常通过
5.重新激活环境
conda activate new_env
6.添加conda镜像
输入4行清华大学的通道代码

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
conda config --set show_channel_urls yes

12345

7.删除镜像

conda config --remove channels  https://mirrors.ustc.edu.cn/anaconda/pkgs/free/

你可能感兴趣的:(conda无法激活)