首页 > 系统相关 >CommandNotFoundError: Your shell has not been properly configured to use ‘conda activate‘.

CommandNotFoundError: Your shell has not been properly configured to use ‘conda activate‘.

时间:2024-01-16 16:35:27浏览次数:28  
标签:CommandNotFoundError use shell init 虚拟环境 conda 激活 activate

问题描述

  • 使用 conda activate 激活虚拟环境时报错:
conda activate virtual_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'.

原因

  • 提示内容已经给出原因,当前使用的 shell 没有配置好 conda activate,需要运行 conda init 初始化 shell
  • 一般使用 zsh shell 时,首次激活 conda 虚拟环境时会遇到

解决方法

  • 方法一:根据提示运行 conda init ,重启 shell 后即可正常使用 conda activate 激活虚拟环境的指令
# 如使用 zsh,则
conda init zsh
# 如果使用 bash,则
conda init bash
  • 方法二:首次激活 conda 虚拟环境,可用 source activate 激活(如下),以后就可以正常使用 conda activate 激活虚拟环境了
# 首次使用 source activate 命令激活虚拟环境 my_conda_virutal_environment
source activate my_conda_virutal_environment
# 退出虚拟环境
conda deactivate
# 以后使用 conda activate 命令激活虚拟环境
conda activate my_conda_virutal_environment

来源:https://blog.csdn.net/sdnuwjw/article/details/112448792

标签:CommandNotFoundError,use,shell,init,虚拟环境,conda,激活,activate
From: https://www.cnblogs.com/kabion536/p/17967950

相关文章

  • 使用shell脚本将doDBA采集到的日志会话信息导入到MySQL数据库
    【背景说明】使用doDBA工具监控的会话信息导入到MySQL数据库的表中【环境说明】doDBA工具采集会话信息(之前有脚本说明)【脚本说明】处理dodba日志信息将日志的innodb日志信息去除审计日志的名称要改为原来的dodba.log名称cd/data/backup/doDBA/log/cpdodba_20231226_09......
  • shell脚本使用 $? 记录返回值
    在shell脚本中,使用$?来获取上一次命令执行时的返回状态。实际使用中需要注意$?可能会被清零或覆盖,最好先使用中间变量存起来,以后使用该中间变量;请看如下几种案例的$?值的变化:1)shellA文件调用 shellB文件  shellB文件:①若有$?=2......
  • 使用shell脚本xtrabackup自动恢复MySQL数据库
    【背景说明】按照安全的一些要求,需要定期对数据库进行恢复演练操作【环境说明】MySQL5.7的xtrabackup全库xbstream的加密备份(如果不是流备份跟加密,去掉相关参数)【脚本说明】v_backupdir="/mysqlbackup/recovery/yiyuan"备份文件的目录路径v_dir="/mysqlbackup/recovery/......
  • shell脚本检测mysql服务状态
    shell脚本检测mysql状态:通过多种方案实现方法一:netstat命令 方法二:ss命令 方法三:使用lsof监控端口 执行结果: ......
  • CDN静态资源加速&Lighthouse性能监测
    本文主要介绍了cdn加速在项目中的实现,以及使用Lighthouse对前端性能指标进行监测打分。Lighthouse简介Lighthouse是谷歌开发并开源的web性能测试工具,用于改进网络应用的质量,可以将其作为一个Chrome扩展程序运行,或从命令行运行。只需要为其提供一个需要审查的地址,Lighthouse就会......
  • (2)Powershell开发工具
    (2)Powershell开发工具在上一节对Powershell进行了简单介绍,详细内容参考Powershell简介,这一节介绍Powershell的开发工具及其设置注意事项。本文包含以下知识点如何启动WindowsPowershell命令行开发工具WindowsPowershell命令行的简单设置如何启动WindowsPowershel......
  • (1)Powershell简介
    (1)Powershell简介本文会包含以下三个知识点什么是Powershell?学习Powershell有什么好处?学习Powershell需要哪些条件?什么是Powershell?Powershell(WindowsPowershell)是Microsoft为Windows设计的新的命令行程序,这个Windows内置的命令行shell包括交互式提示和脚本环......
  • Redis - Sorted Set Use Cases
         ......
  • Redis - Set Use Cases
          ......
  • 软件测试/测试开发/全日制|Pytest如何使用autouse实现自动传参
    Pytestfixture之autouse使用写自动化用例会写一些前置的fixture操作,用例需要用到就直接传该函数的参数名称就行了。当用例很多的时候,每次都传这个参数,会比较麻烦。fixture里面有个参数autouse,默认是Fasle没开启的,可以设置为True开启自动使用fixture功能,这样用例就不用每次都去传参......