【python环境搭建】conda 安装过程中无法激活 python 虚拟环境问题

目录

1.概要

2.解决办法


1.概要

最近重新学习python 需要搭建conda 环境 遇到一个懵逼的问题

C:\Users\67656>conda activate Date

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
If using 'conda activate' from a batch script, change your
invocation to 'CALL conda.bat activate'.

To initialize your shell, run

CSDN 上搜了一堆,照着试了试问题还是没有解决。没办法只能自己想办法,思考了一下这种问题的原因,应该是windows 环境变量配置有问题

这是别人的例子怎么解决 问题,没有找到根本原因

C:\Users\67656>conda init cmd.exe
no change     D:\InstallApp\Anaconda3\Scripts\conda.exe
no change     D:\InstallApp\Anaconda3\Scripts\conda-env.exe
no change     D:\InstallApp\Anaconda3\Scripts\conda-script.py
no change     D:\InstallApp\Anaconda3\Scripts\conda-env-script.py
no change     D:\InstallApp\Anaconda3\condabin\conda.bat
no change     D:\InstallApp\Anaconda3\Library\bin\conda.bat
no change     D:\InstallApp\Anaconda3\condabin\_conda_activate.bat
no change     D:\InstallApp\Anaconda3\condabin\rename_tmp.bat
no change     D:\InstallApp\Anaconda3\condabin\conda_auto_activate.bat
no change     D:\InstallApp\Anaconda3\condabin\conda_hook.bat
no change     D:\InstallApp\Anaconda3\Scripts\activate.bat
no change     D:\InstallApp\Anaconda3\condabin\activate.bat
no change     D:\InstallApp\Anaconda3\condabin\deactivate.bat
no change     D:\InstallApp\Anaconda3\Scripts\activate
no change     D:\InstallApp\Anaconda3\Scripts\deactivate
no change     D:\InstallApp\Anaconda3\etc\profile.d\conda.sh
no change     D:\InstallApp\Anaconda3\etc\fish\conf.d\conda.fish
no change     D:\InstallApp\Anaconda3\shell\condabin\Conda.psm1
no change     D:\InstallApp\Anaconda3\shell\condabin\conda-hook.ps1
no change     D:\InstallApp\Anaconda3\Lib\site-packages\xontrib\conda.xsh
no change     D:\InstallApp\Anaconda3\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. <==


C:\Users\67656>conda activate Base

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
If using 'conda activate' from a batch script, change your
invocation to 'CALL conda.bat activate'.

To initialize your shell, run

    $ conda init 

Currently supported shells are:
  - bash
  - cmd.exe
  - 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'.



C:\Users\67656>

实际上问题没有解决。

2.解决办法

因为是在用户环境中所以需要设置conda 的环境变量

【python环境搭建】conda 安装过程中无法激活 python 虚拟环境问题_第1张图片

 用户环境需要添加环境变量【python环境搭建】conda 安装过程中无法激活 python 虚拟环境问题_第2张图片

 

当然系统环境下,最好尽量也去配置

【python环境搭建】conda 安装过程中无法激活 python 虚拟环境问题_第3张图片

两个都加是双保险

以下自己的运行结果

【python环境搭建】conda 安装过程中无法激活 python 虚拟环境问题_第4张图片

 运行jupyter notebook

【python环境搭建】conda 安装过程中无法激活 python 虚拟环境问题_第5张图片

jupyter notebook 运行成功 

【python环境搭建】conda 安装过程中无法激活 python 虚拟环境问题_第6张图片

 

你可能感兴趣的:(一周学python,基础语法,conda,python,scrapy)