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

  • 相关阅读:
    c# 测试篇之Linq性能测试
    F# 笔记
    c# DataSource和BindingSource
    .net中配置的保存格式笔记
    泛型约束(转)
    c# 调用showDialog后需要Dispose
    c# 实现ComboBox自动模糊匹配
    c# 二进制或算法实现枚举的HasFlag函数
    C# WinForm自定义控件整理
    微软中文MSDN上的一些文章链接
  • 原文地址:https://www.cnblogs.com/liyongjian5179/p/10681844.html
Copyright © 2011-2022 走看看