简体   繁体   中英

Changing PS1 with conda

I want to change my prompt from ~ $ to ~ > when activating conda .

I tried using env_prompt: in .condarc but it displays > ~ $ instead of the desired ~ > prompt.

(The conda prompt is preceded by the original PS1)

Can someone provide an example on how to implement this in my .bashrc ?

Conda's changeps1 functionality is limited to prepending a string to the shell's PS1. This string can be specified using the configuration variable env_prompt (as OP indicates). For completeness, here is how to query the documentation:

env_prompt

$ conda config --describe env_prompt
# # env_prompt (str)
# #   Template for prompt modification based on the active environment.
# #   Currently supported template variables are '{prefix}', '{name}', and
# #   '{default_env}'. '{prefix}' is the absolute path to the active
# #   environment. '{name}' is the basename of the active environment
# #   prefix. '{default_env}' holds the value of '{name}' if the active
# #   environment is a conda named environment ('-n' flag), or otherwise
# #   holds the value of '{prefix}'. Templating uses python's str.format()
# #   method.
# # 
# env_prompt: '({default_env}) '

To customize other aspects of PS1, one must do this independently of Conda. That is, you will need to consult the documentation for your shell (eg, bash, zsh) or terminal.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM