Activating a VirtualEnv using a shell script doesn't seem to work

后端 未结 5 1745
孤独总比滥情好
孤独总比滥情好 2020-12-23 19:16

I tried activating a VirtualEnv through a shell script like the one below but it doesn\'t seem to work,

#!/bin/sh
source ~/.virtualenvs/pinax-env/bin/activa         


        
5条回答
  •  攒了一身酷
    2020-12-23 20:09

    source is an builtin shell command in bash, and is not available in sh. If i remember correctly then virtual env does a lot of path and environment variables manipulation. Even running it as bash virtualenv_blah.sh wont work since this will simply create the environment inside the sub-shell.

    Try . virtualenv_activate.sh or source virtualenv_activate.sh this basically gets the script to run in your current environment and all the environment variables modified by virtualenv's activate will be available.

    HTH.

    Edit: Here is a link that might help - http://ss64.com/bash/period.html

提交回复
热议问题