如何解决‘CommandNotFoundError: Your shell has not been properly configured to use ‘conda activate’错误

最近在Windows下使用Anaconda时遇到了'CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'错误,错误显示如下:

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

其实这是初次使用Anaconda时,没有预先对命令行进行预载的结果。解决办法非常简单,只需根据Anaconda的提示运行对应的命令即可。

Windows:

conda init cmd.exe

Linux(使用bash):

conda init bash

总之,对于不同的命令行软件,只需要运行如Anaconda提示中的命令:

conda init {TERMINAL_TYPE}

就能够解决该报错问题。

顺便提一嘴,这篇文章是我在看了数篇完全一致但作者不同的CSDN文章之后,发现毫无用处之后一怒之下自行解决后发出来的,CSDN的抄袭现象之严重真的不敢恭维。

  • 93
    点赞
  • 80
    收藏
    觉得还不错? 一键收藏
  • 10
    评论
Shell Scripting Recipes, 2nd Edition is filled with over 150 much-needed and practical recipes that follow a problem-solution format, and help all Unix users regain some of the lost time spent creating and testing shell scripts. Most scripts in this book are POSIX (Portable Operating System Interface)-compliant, so they are supported by many of the major shell variants, including Bash, ksh, and sh, among others. This completely updated second edition takes into account the many changes to shell scripting that have occurred since its original publication nearly ten years ago, and all the recipes are now relevant for a modern audience. Each real-world example recipe follows the same structure and easily shows you what's going on in each case. File conversion (DOS, UNIX, and Mac), system administration, and resource monitoring are just a few of the topics covered in this highly practical shell scripting reference. You will also find recipes for filename management, complex date calculations, screen control capabilities, and more. Author Chris Johnson's code is clear, direct, and applicable, and he explains everything well in each recipe so that you understand not just how to do something, but why to do it that way. Shell Scripting Recipes is an invaluable book and one to add to your library today. What you’ll learn How to effectively use the POSIX shell and command-line utilities How to use strings, numbers, words, and filenames with ease Effective file management and file conversion (DOS, UNIX, and Mac) How to monitor resources effectively How to perform complex date calculations Manage a POP3 email server Who this book is for This book is for anyone who has the basic knowledge of what shell scripting is and wants to learn how to use it properly. Each recipes is explained clearly and the book begins with the simplest recipes, so all you need is a basic knowledge of what shell scripting is. Table of Contents Chapter 1: The POSIX Shell and Command-Line Utilities Chapter 2: Playing with Files: Viewing, Manipulating, and Editing Text Files Chapter 3: String Briefs Chapter 4: What's in a Word? Chapter 5: Scripting by Numbers Chapter 6: Loose Names Sink Scripts: Bringing Sanity to Filenames Chapter 7: Treading a Righteous PATH Chapter 8: The Dating Game Chapter 9: Good Housekeeping: Monitoring and Tidying Up File Systems Chapter 10: Screenplay: The screen-funcs Library Chapter 11: Aging, Archiving, and Deleting Files Chapter 12: Covering All Your Databases Chapter 13: Home on the Web Chapter 14:Taking Care of Business Chapter 15: Random Acts of Scripting Chapter 16: A Smorgasbord of Scripts Chapter 17: Script Development Management Appendix: Internet Scripting Resources
Welcome to Beginning C++17. This is a revised and updated version of Ivor Horton’s original book called Beginning ANSI C++. The C++ language has been extended and improved considerably since then, so much so that it was no longer possible to squeeze detailed explanations of all of C++ into a single book. This tutorial will teach the essentials of the C++ language and Standard Library features, which will be more than enough for you to write your own C++ applications. With the knowledge from this book, you should have no difficulty in extending the depth and scope of your C++ expertise. We have assumed no prior programming knowledge. If you are keen to learn and have an aptitude for thinking logically, getting a grip on C++ will be easier than you might imagine. By developing C++ skills, you’ll be learning a language that is already used by millions and that provides the capability for application development in just about any context. C++ is very powerful. Arguably, it’s more powerful than most programming languages. So, yes, like with any powerful tool you can wield some considerable damage if you use it without proper training. We often compare C++ to a Swiss Army knife: age-old, trusted, incredibly versatile, yet potentially mind-boggling and full of pointy things that could really hurt you. Once someone clearly explains to you what all the different tools are meant for, however, and teaches you some elementary knife safety rules, then you’ll never have to look for another pocketknife again. C++ does not need to be dangerous or difficult at all either. C++ today is much more accessible than many people assume. The language has come a long way since its conception nearly 40 years ago. In essence, we have learned how to wield all its mighty blades and tools in the safest and most effective way possible. And, more importantly perhaps, the C++ language and its Standard Library have evolved accordingly to facilitate this. The past decade in particular has seen the ris
### 回答1: 这个错误提示意思是你的Shell(命令行界面)没有正确配置使用“conda activate”命令。如果你在批处理脚本中使用“conda activate”命令,需要将调用方式改为“call conda.bat activate”。这个问题可能出现在使用conda虚拟环境时,通常是因为conda的环境变量没有正确设置或者配置文件被更改了。你可以检查一下你的环境变量设置,确保conda的路径已经被添加到了系统的PATH变量中,或者重新安装conda以修复配置文件。 ### 回答2: 这个问题是因为在使用conda时,shell没有正确配置'conda activate'所导致的。如果你正在使用批处理脚本并尝试使用'conda activate',那么你需要将调用更改为'call conda.bat activate'。 首先,我们需要了解什么是conda,它是一个开源软件包管理器,它可以安装、管理和卸载多个软件包,包括Python程序和库。在使用conda之前,我们需要先安装它,并且在安装完成后需要进行配置,以便它可以正常工作。 当我们执行'conda activate'命令时,它会启动环境,这是一组包和Python版本的集合,用于特定的项目或任务。通常情况下,当你在命令行中输入'conda activate'命令时,shell会根据你的配置自动使用它。但是,如果shell没有正确配置'conda activate',那么你会遇到这个错误。 在批处理脚本中,'conda activate'可能会与其他命令冲突,并且shell也可能不会正确地识别它。为了解决这个问题,我们需要使用'call conda.bat activate'命令来替换'conda activate'。这将确保'conda activate'命令可以正常工作,并且它可以在批处理脚本中正确地运行。 要解决这个问题,可以按照以下步骤操作: 1. 检查conda是否已正确安装并设置环境变量。 2. 运行'conda.bat activate',确保环境可以正常工作。 3. 在批处理脚本中使用'call conda.bat activate'代替'conda activate'命令。 总之,这个问题可能是由于condashell之间的配置问题所导致的,在批处理脚本中使用'call conda.bat activate'命令可以解决它。这将确保环境可以正常工作,并确保你的程序代码可以正常运行。 ### 回答3: 这个问题的意思是你的计算机的shell没有正确的配置去使用'conda activate'。'conda'是一个针对Python的包管理器,用于管理Python环境。如果没有正确配置'conda activate',在使用该功能时会遇到错误。 当你在批处理脚本中使用'conda activate'时,你需要将调用改为'call conda.bat activate'。这是因为在Windows中,使用了批处理脚本而不是直接在命令提示符中运行,在使用'conda'时需要加上'call'来调用'conda.bat'。 要解决这个问题,需要进行以下步骤: 1. 确认你已经正确安装'conda'。如果没有安装,就需要先安装'conda'。 2. 确认你的环境变量正确配置。需要将'conda'的安装路径添加到系统环境变量路径中。可以在命令提示符中输入'echo %PATH%'来查看当前系统环境变量路径。 3. 如果仍然不能使用'conda',那么就需要手动配置'conda'。这个需要修改'.bashrc'或'.bash_profile'文件中的内容,以让系统正确执行'conda activate'。 如果以上步骤都没有帮助你解决问题,那么你可以尝试卸载并重新安装'conda'。你还可以在'conda'的官方网站上查找相关的资料,以便更好地了解'conda'的使用和配置。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值