开发者

This bash script is not working - Linux/Python

I can't seem to figure out how to get his bash script working.

#!/bin/bash 
export WORKON_HOME=~/.envs
source /usr/local/bin/virtualenvwrapper.s开发者_运维知识库h
workon staging_env

It is using viretualenv and virualenvwrapper in order to use a Python virtual environment.

Typing these commands in the shell work perfectly fine, running it as a bash script does not work though.


Any ideas?


When you run a script, it creates its own instance of the shell (bash, in this case). Because of this, the changes are lost when the script ends and the script's shell is closed.

To make the changes stick, you'll have to source the script instead of running it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜