在Fish-shell

时间:2017-03-18 06:31:47

标签: anaconda fish

我关注conda_PR_545conda issues 4221但仍然没有使用Ubuntu。

here下载conda.fish后,将其转换为anaconda3 / bin /.

添加"来源/home/phejimlin/anaconda3/bin/conda.fish"在〜/ .config / fish / config.fish。

的末尾
conda activate spark_env
Traceback (most recent call last):
File "/home/phejimlin/anaconda3/bin/conda", line 6, in 
sys.exit(conda.cli.main())
File "/home/phejimlin/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 161, in main
raise CommandNotFoundError(argv1, message)
TypeError: init() takes 2 positional arguments but 3 were given

activate spark_env
Error: activate must be sourced. Run 'source activate envname'
instead of 'activate envname'.

我错过了什么吗?

3 个答案:

答案 0 :(得分:42)

截至鱼类2.6.0 conda 4.3.27:以下步骤可能会更改为issue is addressed

更新配置

记下您的conda位置

conda info --root
/Users/mstreeter/anaconda    # this is my <PATH_TO_ROOT>

将行添加到~/.config/fish/config.fish

 source <PATH_TO_ROOT>/etc/fish/conf.d/conda.fish

更新约定

通常,您需要从bash

运行以下内容
source activate <environment>
source deactivate <environment>

现在,您必须从fish

运行以下内容
conda activate <environment>
conda deactivate <environment>

问题

所以在执行此操作后,我无法将fish设置为我的默认shell,并且仍然可以使用conda正常运行。目前,我必须首先输入我的默认shell,然后输入fish并且shell按预期工作。在我找到如何让它完全正常工作而不需要在每次登录终端时明确选择fish

之后我会更新此内容

答案 1 :(得分:28)

如果您关注https://github.com/conda/conda/issues/2611,则步骤(从开始):

[root@6903a8d80f9b ~]# fish
root@6903a8d80f9b ~# echo $FISH_VERSION 
2.4.0
root@6903a8d80f9b ~# bash Miniconda2-4.3.11-Linux-x86_64.sh -b -p /conda
root@6903a8d80f9b ~# source /conda/etc/fish/conf.d/conda.fish
root@6903a8d80f9b ~# conda activate root
root@6903a8d80f9b ~# conda create -yn fishtest                              (root) 
Fetching package metadata .........
Solving package specifications: 
Package plan for installation in environment /conda/envs/fishtest:

#
# To activate this environment, use:
# > source activate fishtest
#
# To deactivate this environment, use:
# > source deactivate fishtest
#

root@6903a8d80f9b ~# conda activate fishtest                                (root) 
root@6903a8d80f9b ~#                                                    (fishtest) 
root@6903a8d80f9b ~# conda deactivate fishtest                          (fishtest) 

答案 2 :(得分:9)

从conda 4.4.0开始,不推荐将conda的bin目录添加到PATH https://github.com/conda/conda/blob/master/CHANGELOG.md#440-2017-12-20

您需要做的就是添加 source <path-to-anaconda>/etc/fish/conf.d/conda.fish 到config.fish。