python开发环境管理:pip和virtualenv

时间:2025-04-16 07:57:21

方便起见,直接将以下代码加入.bashrc,因为有些环境下.bash_profile不会被执行

# 设置virtualenv 工作的目录. 我们放在用户跟目录下
export WORKON_HOME=$HOME/.virtualenvs

# ensure all new environments are isolated from the site-packages directory    
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'    

# use the same directory for virtualenvs as virtualenvwrapper    
export PIP_VIRTUALENV_BASE=$WORKON_HOME    

# makes pip detect an active virtualenv and install to it    
export PIP_RESPECT_VIRTUALENV=true    

if [[ -r /usr/local/bin/ ]]; then        
    source /usr/local/bin/    
else        
    echo "WARNING: Can't find "    
fi

相关文章