2020-12-01 CommandNotFoundError: Your shell has not been properly configured to use 'conda activa...

conda 切换环境以前是source <env>
更新后变成了 conda <env>
但是更新后有个问题,就是当你把conda写进shell里,会报错:

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装的了,这时就需要我们把conda包装到脚本里,让运行时自己运行conda,这样busco就是我们包装后的脚本了:

#run busco
#!/usr/bin/bash
conda activate busco
export AUGUSTUS_CONFIG_PATH="/biosoft/anaconda2/envs/busco/config"
export BUSCO_CONFIG_FILE="/biosoft/anaconda2/envs/busco/config/config.ini"
/biosoft/anaconda2/envs/busco/bin/busco_run $@

看来这个报错是一定要解决的,在网上看了很多方式,比如先source activate、加环境变量等等,对于目前的conda来说都已经无效了。
最后还是在github上的一个方法解决了:https://github.com/facebookresearch/demucs/issues/18
就是找到你的conda.sh,然后source一下,相当于重置当前conda的环境变量

#!/usr/bin/bash
source /biosoft/anaconda2/etc/profile.d/conda.sh
conda activate busco
... ...

解决。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容