windows下conda安装及配置,解决遇到的问题

一、windows下conda安装
1.下载Miniconda
windows下conda安装及配置,解决遇到的问题_第1张图片
2.安装后配置环境变量
找到自己的安装路径,将下面三个路径添加到环境变量
D:\Users\grfood126\miniconda3
D:\Users\grfood126\miniconda3\Scripts
D:\Users\grfood126\miniconda3\Library\bin
二、conda配置
1.创建环境
D:\Users\grfood126\miniconda3\Library\bin

>conda create env

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

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

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

conda create -n new_env

3.激活环境

conda activate new_env

错误

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

    $ conda init <SHELL_NAME>

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

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

WARNING: Cannot install xonsh wrapper without a python interpreter in prefix: C:
\Users\User1\AppData\Local\Temp\_MEI50762
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\Scripts\conda.exe
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\Scripts\conda-env.exe
modified      C:\Users\User1\AppData\Local\Temp\_MEI50762\Scripts\conda-script.py
modified      C:\Users\User1\AppData\Local\Temp\_MEI50762\Scripts\conda-env-script.py
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\condabin\conda.bat
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\Library\bin\conda.bat
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\condabin\_conda_activate.bat
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\condabin\rename_tmp.bat
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\condabin\conda_auto_activate.bat
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\condabin\conda_hook.bat
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\Scripts\activate.bat
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\condabin\activate.bat
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\condabin\deactivate.bat
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\Scripts\activate
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\Scripts\deactivate
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\etc\profile.d\conda.sh

needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\etc\fish\conf.d\conda.fish
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\shell\condabin\Conda.psm1
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\shell\condabin\conda-hook.ps1
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\etc\profile.d\conda.csh
modified      HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun

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

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

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

网上搜索问题后,发现配置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

7.删除镜像

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

你可能感兴趣的:(anaconda,python,数据分析)