zoukankan      html  css  js  c++  java
  • 【解决】venv 的名字在 zsh prompt 中不显示

    venv 的名字在 zsh prompt 中不显示

    ➜ liyongjiandeMBP.lan [/Users/liyongjian/lyj] python3 -m venv lyj_venv
    ➜ liyongjiandeMBP.lan [/Users/liyongjian/lyj] source ./lyj_venv/bin/activate
    ➜ liyongjiandeMBP.lan [/Users/liyongjian/lyj] python

    我的 zsh 使用的是 robbyrussell 主题,进入到 ~/.oh-my-zsh/plugins/virtualenv

    ➜ liyongjiandeMBP.lan [/Users/liyongjian/.oh-my-zsh/plugins/virtualenv] git:(master) ✗ cat virtualenv.plugin.zsh
    function virtualenv_prompt_info(){
    [[ -n ${VIRTUAL_ENV} ]] || return
    echo "${ZSH_THEME_VIRTUALENV_PREFIX:=[}${VIRTUAL_ENV:t}${ZSH_THEME_VIRTUALENV_SUFFIX:=]}"
    }
    
    # disables prompt mangling in virtual_env/bin/activate
    export VIRTUAL_ENV_DISABLE_PROMPT=1

    将 `export VIRTUAL_ENV_DISABLE_PROMPT=1` 注释掉,然后 source ~/.zshrc

    ➜ liyongjiandeMBP.lan [/Users/liyongjian/lyj] python3 -m venv lyj_venv
    ➜ liyongjiandeMBP.lan [/Users/liyongjian/lyj] source ./lyj_venv/bin/activate
    (lyj_venv) ➜ liyongjiandeMBP.lan [/Users/liyongjian/lyj] python
    Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 16:52:21)
    [Clang 6.0 (clang-600.0.57)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> ^D
    (lyj_venv) ➜ liyongjiandeMBP.lan [/Users/liyongjian/lyj]

    参考:https://stackoverflow.com/questions/38928717/virtualenv-name-not-show-in-zsh-prompt

  • 相关阅读:
    NOIP2016 愤怒的小鸟
    LCIS code force 10D
    UVA 1398
    uva1382 Distant Galaxy
    洛谷-3930(我在洛谷上也写了题解)
    HDU-1505 City Game
    导弹拦截n logn的算法(单调性)洛谷1020
    POJ 1182 食物链
    POJ
    1202. 交换字符串中的元素
  • 原文地址:https://www.cnblogs.com/liyongjian5179/p/10681844.html
Copyright © 2011-2022 走看看