Conda环境是可发现但不可激活的(当激活是bash别名时) [英] Conda environment is discoverable but not activateable (when activate is a bash alias)

查看:816
本文介绍了Conda环境是可发现但不可激活的(当激活是bash别名时)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Conda版本4.2.9,来自RedHat 4.4.7-1的anaconda3 4.2.0安装.

Conda version 4.2.9, from the anaconda3 4.2.0 installation for RedHat 4.4.7-1.

[user@machine]$ conda info --envs
# conda environments:
#
molr-py3                 /home/user/anaconda3/envs/molr-py3
root                  *  /home/user/anaconda3

[user@machine]$ source activate molr-py3
CondaEnvironmentNotFoundError: Could not find environment: molr-py3 .
You can list all discoverable environments with `conda info --envs`.

在这种情况下,我什至不确定要采取哪些调试步骤.我已经验证conda来自正确的anaconda路径,等等.

I'm not even sure what debugging steps to take in this case. I've verified that conda comes from the right anaconda path, etc.

我还在envs目录和anaconda3目录中尝试了chmod -R a+rwX,但这没有影响.

I also tried chmod -R a+rwX on the envs directory and then the anaconda3 directory, but this had no impact.

.bashrc中所有不同的conda-*命令都具有别名,以指向anaconda3/bin内部现有的版本,因此它不使用任何anaconda2版本的conda东西.另外,anaconda3/bin中的activate脚本被别名为activate,因此它也不使用anaconda2 activate脚本.

All of the different conda-* commands are aliased in .bashrc to point to the versions existing inside anaconda3/bin, so it's not using any anaconda2 versions of conda stuff. Additionally, the activate script from anaconda3/bin is aliased to activate so it's not using the anaconda2 activate script either.

conda info

Current conda install:

               platform : linux-64
          conda version : 4.2.9
       conda is private : False
      conda-env version : 4.2.9
    conda-build version : 2.0.2
         python version : 3.5.2.final.0
       requests version : 2.11.1
       root environment : /home/user/anaconda3  (writable)
    default environment : /home/user/anaconda3
       envs directories : /home/user/anaconda3/envs
          package cache : /home/user/anaconda3/pkgs
           channel URLs : https://repo.continuum.io/pkgs/free/linux-64/
                          https://repo.continuum.io/pkgs/free/noarch/
                          https://repo.continuum.io/pkgs/pro/linux-64/
                          https://repo.continuum.io/pkgs/pro/noarch/
            config file : None
           offline mode : False

更新

如果我完全拼写了anaconda3激活脚本的路径,那么它将起作用.例如.以下将起作用,

If I fully spell out the path to the anaconda3 activate script, then it works. E.g. the following will work,

source /home/user/anaconda3/bin/activate molr-py3

即使已设置,

[user@machine]$ which activate
alias activate='/home/user/anaconda3/bin/activate'
    ~/anaconda3/bin/activate

以下内容无效起作用,

[user@machine]$ source activate molr-py3
CondaEnvironmentNotFoundError: Could not find environment: molr-py3 .
You can list all discoverable environments with `conda info --envs`.

推荐答案

设置别名的source部分:

alias activatepy3='source /home/user/anaconda3/bin/activate' 

现在处于活动状态:

activatepy3 molr-py3

deactivate执行相同操作.

这篇关于Conda环境是可发现但不可激活的(当激活是bash别名时)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆