1.进入WSL的终端html
2.建立env.sh脚本,内容以下:python
export WORKON_HOME=你环境的总目录if [ ! -d "$WORKON_HOME/$1/" ];then echo "environment $1 dones't exist!" else export PS1=" ($1) $(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version) %{$fg[$CARETCOLOR]%}▶%{$resetcolor%}" alias python="$WORKON_HOME/$1/Scripts/python.exe" alias pip="$WORKON_HOME/$1/Scripts/pip.exe" fi
3.若是使用了zsh,则在~/.zshrc中添加一行git
alias env='source 你的路径/env.sh $1
4.执行一下source ~/.zshrc,而后就能够经过ruby
env 环境名称
切换到Windows的virtualenv环境中了,并且还能够直接经过运行pip来为该环境安装或者删除软件spa
内容为原创,转载请注明:https://www.cnblogs.com/huangshiyu13/p/10393630.htmlcode