anaconda的fish shell支持
最近在用fish shell,但是无法使用conda的activate命令来激活环境.官方给的有解决方案
https://github.com/conda/conda/blob/5b97a96d78e65d8178eb60d36e0fc99cd5b3ab21/bin/conda.fish
将这个里面的内容复制到自己的config.fish在source一下就可以了
- #
- # Conda environment activate / deactivate functions for fish shell v2.2.0+.
- #
- # Ivan Smirnov (C)
- #
- #
- # INSTALL
- #
- # Source this file from the fish shell to enable activate / deactivate functions.
- # In order to automatically load these functions on fish startup, append
- #
- # source (conda info --root)/bin/conda.fish
- #
- # to the end of your ~/.config/config.fish file.
- #
- # USAGE
- #
- # To activate an environment (via name or path), you can use one of the following:
- #
- # activate ENV
- # conda activate ENV
- #
- # To deactivate an environment, use one of:
- #
- # deactivate
- # conda deactivate
- #
- # To make the env name appear on the left side, set an environment variable:
- #
- # set -gx CONDA_LEFT_PROMPT
- #
- # To go back to making the env name appear on the right, erase that variable:
- #
- # set -e CONDA_LEFT_PROMPT
- # Require version fish v2.+ to be able to use array slices, `else if`
- # and $status for command substitutions
- if [ (echo (fish -v ^&) | sed 's/^.*version \([0-9]\)\..*$/\1/') -lt ]
- echo 'Incompatible fish shell version; please upgrade to v2.0 or higher.'
- exit
- end
- function __conda_delete_function
- functions -e $argv
- if functions -q $argv
- functions -e $argv
- end
- end
- function __conda_restore_prompt
- if functions -q __fish_prompt_orig
- __conda_delete_function fish_prompt
- functions -c __fish_prompt_orig fish_prompt
- functions -e __fish_prompt_orig
- end
- if functions -q __fish_right_prompt_orig
- __conda_delete_function fish_right_prompt
- functions -c __fish_right_prompt_orig fish_right_prompt
- functions -e __fish_right_prompt_orig
- end
- end
- function __conda_backup_prompt
- functions -e __fish_prompt_orig
- if functions -q fish_prompt
- functions -c fish_prompt __fish_prompt_orig
- functions -e fish_prompt
- else
- function __fish_prompt_orig
- end
- end
- functions -e __fish_right_prompt_orig
- if functions -q fish_right_prompt
- functions -c fish_right_prompt __fish_right_prompt_orig
- functions -e fish_right_prompt
- else
- function __fish_right_prompt_orig
- end
- end
- end
- function __conda_echo_env
- set_color normal
- echo -n '('
- set_color -o green
- echo -n $CONDA_DEFAULT_ENV
- set_color normal
- echo -n ') '
- end
- # Inject environment name into fish_right_prompt / fish_prompt
- function __conda_update_prompt
- if [ (conda '..changeps1') -eq ]
- switch $argv[]
- case activate
- __conda_restore_prompt
- __conda_backup_prompt
- function fish_prompt
- if set -q CONDA_LEFT_PROMPT
- __conda_echo_env
- end
- __fish_prompt_orig
- end
- function fish_right_prompt
- if not set -q CONDA_LEFT_PROMPT
- __conda_echo_env
- end
- __fish_right_prompt_orig
- end
- case deactivate
- __conda_restore_prompt
- end
- end
- end
- # Convert colon-separated path to a legit fish list
- function __conda_set_path
- set -gx PATH (echo $argv[] | tr : \n)
- end
- # Calls activate / deactivate functions if the first argument is activate or
- # deactivate; otherwise, calls conda-<cmd> and passes the arguments through
- function conda
- if [ (count $argv) -lt ]
- command conda
- else
- if [ (count $argv) -gt ]
- set ARGS $argv[..-]
- else
- set -e ARGS
- end
- switch $argv[]
- case activate deactivate
- eval $argv
- case '*'
- command conda $argv
- end
- end
- end
- # Equivalent to bash version of conda activate script
- function activate --description 'Activate a conda environment.'
- if [ (count $argv) -lt ]
- echo 'You need to specify a conda environment.'
- return
- end
- # deactivate an environment first if it's set
- if set -q CONDA_DEFAULT_ENV
- conda '..checkenv' $argv[]
- if [ $status = ]
- __conda_set_path (conda '..deactivate')
- set -e CONDA_DEFAULT_ENV
- __conda_update_prompt deactivate
- else
- return
- end
- end
- # try to activate the environment
- set -l NEW_PATH (conda '..activate' $argv[])
- if [ $status = ]
- __conda_set_path $NEW_PATH
- if [ (echo $argv[] | grep '/') ]
- pushd (dirname $argv[])
- set -gx CONDA_DEFAULT_ENV (pwd)/(basename $argv[])
- popd
- else
- set -gx CONDA_DEFAULT_ENV $argv[]
- end
- __conda_update_prompt activate
- else
- return $status
- end
- end
- # Equivalent to bash version of conda deactivate script
- function deactivate --description 'Deactivate the current conda environment.'
- if set -q CONDA_DEFAULT_ENV # don't deactivate the root environment
- set -l NEW_PATH (conda '..deactivate' $argv[])
- if [ $status = ]
- __conda_set_path $NEW_PATH
- set -e CONDA_DEFAULT_ENV
- __conda_update_prompt deactivate
- else
- return $status
- end
- end
- # return
- end
anaconda的fish shell支持的更多相关文章
- Fish Shell
今天看到阮一峰同学的一篇博客(Fish shell 入门教程),讲述的非常详细.清楚,有兴趣的可以直接转去查看此文,本文仅提供一下个人使用心得. 一.fish shell 想必接触过类unix(包括w ...
- fish shell 下gopath的设置问题
GOPATH可以设置多个工程目录,linux下用冒号分隔(必须用冒号,fish shell的空格分割会出错),windows下用分号分隔,但是go get 只会下载pkg到第一个目录,但是编译的时候会 ...
- Linux Shell管道调用用户定义函数(使shell支持map函数式特性)
Linux中有一个管道的概念,常用来流式的处理文本内容,比如一个文件对其中的每一行应用好几个操作,出于两个方面的考虑可能需要在管道中使用用户定义函数: 1. 刚需: 内置的sed/awk之类的可能没法 ...
- fish shell version
如果你使用 fish shell, 想要自己定义变量,或者函数,或者alias, 不要使用 version 这个名字, 因为,version 这个名字 被 fish 本身占了.... ...
- Mac开发必备工具(三)—— Fish shell
Fish shell 简介 fish 可以根据输入自动匹配历史命令.它的一大特点是开箱即用,没有zsh那些繁琐的配置.官网:http://www.fishshell.com/. 安装与配置 在终端里使 ...
- Fish Shell使用心得
Fish的官网宣传语是 Finally, a command line shell for the 90s. 翻译过来就是 Fish shell 是一个为90后准备的 shell. 有人说:" ...
- fish shell 自动补全子命令
之前在 「创建 fish shell 自动补全文件」 中介绍了如何创建 fish 的补全文件,实现对命令的友好补全提示.通过形如 complete -c <command> -a [&qu ...
- Mac安装fish shell
1.brew update 2.brew install fish 3.sudo vi /etc/shells 增加内容:/usr/local/bin/fish ##增加fish到shell环境变 ...
- 在 Ubuntu16.04上安装anaconda+Spyder+TensorFlow(支持GPU)
TensorFlow 官方文档中文版 http://www.tensorfly.cn/tfdoc/get_started/introduction.html https://zhyack.github ...
随机推荐
- Selenium+Python进行web自动化测试(Demo+API)
Selenium官方网站 http://selenium-python.readthedocs.io/ 配置使用环境 下载相应的浏览器驱动, Firefox 是默认的 本文以 chrome 为主 ,放 ...
- Java经典编程题50道之十四
输入某年某月某日,判断这一天是这一年的第几天? public class Example14 { public static void main(String[] args) { ...
- applicationContext.xml最基本配置文件
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...
- hihoCoder 1523 数组重排2 贪心
题意:给定一个1-N的排列A1, A2, - AN,每次操作小Hi可以选择一个数,把它放到数组的最左边. 请计算小Hi最少进行几次操作就能使得新数组是递增排列的. 思路:最后的序列是递增的,那么必定满 ...
- 《清华梦的粉碎》by王垠
清华梦的诞生 小时候,妈妈给我一个梦.她指着一个大哥哥的照片对我说,这是爸爸的学生,他考上了清华大学,他是我们中学的骄傲.长大后,你也要进入清华大学读书,为我们家争光.我不知道清华是什么样子,但是我 ...
- PHPstudy端口占用的问题
phpStudy很多同学下好了 用localhost可能不能读取到WWW目录下的文件,这个是因为端口被占用,打开其他选项菜单 =>打开配置文件=>httpd-conf=>修改端口号如 ...
- 关于.Net的知识和相关书籍
a. DBCC DROPCLEANBUFFERS 清空缓存信息b. DBCC FREEPROCCACHE 从过程缓存中删除所有元素2. 引用两个和尚打水的故事,说明平时要注重积累,只有量变达到了才会形 ...
- Storm+HBase实时实践
1.HBase Increment计数器 hbase counter的原理: read+count+write,正好完成,就是讲key的value读出,若存在,则完成累加,再写入,若不存在,则按&qu ...
- 关于VS2013调试IIS应用源代码时无法进入断点的问题总结
调试无法进入断点 前言:今天再次遇到之前调试无法进入断点的问题,本来想不写呢觉得没什么只是又犯了同样的错误,但是我发现这个问题我分析起来还是挺费劲的,我仔细想了想原因, 是因为自己对之前的错误没有进行 ...
- 【DDD】领域驱动设计实践 —— 一些问题及想法
在社区系统的DDD实践过程中,将遇到一些问题和产生的想法记录下来,共讨论. 本文为[DDD]系列文章中的其中一篇,其他内容可参考:使用领域驱动设计思想实现业务系统. 1.dto.model和entit ...