pycharam提示CommandNotFoundError: No command 'conda run'.该怎么办
在cmd里可以激活虚拟环境 但是在pycharm的终端想要激活虚拟环境就显示
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
If your shell is Bash or a Bourne variant, enable conda for the current user with
$ echo ". C:\ProgramData\Anaconda3/etc/profile.d/conda.sh" >> ~/.bashrc
or, for all users, enable conda with
$ sudo ln -s C:\ProgramData\Anaconda3/etc/profile.d/conda.sh /etc/profile.d/conda.sh
The options above will permanently enable the 'conda' command, but they do NOT
put conda's base (root) environment on PATH. To do so, run
$ conda activate
in your terminal, or to put the base environment on PATH permanently, run
$ echo "conda activate" >> ~/.bashrc
Previous to conda 4.4, the recommended way to activate conda was to modify PATH in
your ~/.bashrc file. You should manually remove the line that looks like
export PATH="C:\ProgramData\Anaconda3/bin:$PATH"
^^^ The above line should NO LONGER be in your ~/.bashrc file! ^^^
【以下回答由 GPT 生成】
问题标题: pycharm中出现'conda run'命令不存在的错误,如何解决?
问题标签: pycharm
问题内容: 在使用pycharm时,提示'conda run'命令不存在的错误。我在cmd命令行中可以成功激活虚拟环境,但在pycharm的终端中想要激活虚拟环境时就出现'CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.'的提示。
请问我应该如何解决这个问题?
这个问题是由于pycharm的终端无法正确识别conda命令导致的。您可以尝试执行以下解决方案来解决问题:
$ echo ". C:\ProgramData\Anaconda3/etc/profile.d/conda.sh" >> ~/.bashrc
这个命令将向您的~/.bashrc文件中添加一行代码,指向conda.sh脚本的路径。
$ sudo ln -s C:\ProgramData\Anaconda3/etc/profile.d/conda.sh /etc/profile.d/conda.sh
这个命令将在/etc/profile.d/目录下创建一个软链接,指向conda.sh脚本的路径。
$ conda activate
这个命令将激活conda的基本(根)环境,然后您就可以在pycharm的终端中成功使用conda命令了。
$ echo "conda activate" >> ~/.bashrc
这个命令将在~/.bashrc文件中添加一行代码,将基本环境添加到PATH中。
export PATH="C:\ProgramData\Anaconda3/bin:$PATH"
这个行应该手动从~/.bashrc文件中删除。
请注意,以上的解决方案适用于大多数情况。如果问题仍然存在,请检查您的系统和pycharm配置以确保正确安装了conda和pycharm,并且路径设置正确。
如果您对以上解决方案不满意或者问题仍然存在,请告诉我,我会尽力帮助您解决问题。
【相关推荐】