Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bash: How refresh shell after installing virtualenvwrapper [Without restarting the shell]?

I am using python-fabric to setup my server, which configures the server programatically.

So, I installed virtualenvwrapper as :

sudo apt-get install virtualenvwrapper

That installed - Virtualenvwrapper and adds its initialization scripts to shell startup.

Generally we restart the shell and it gets initialized, but in my case I can-not restart the shell over fabric.

Since it was installed with apt-get I was not able to find the initialization scripts entry in ~/.bashrc or ~/.bash_profile or /etc/bash.bashrc

So, where did apt-get added call to the initialization scripts ?

How to refresh the shell without restarting the shell ?

like image 819
Yugal Jindle Avatar asked Jun 20 '12 07:06

Yugal Jindle


People also ask

What is virtualenv wrapper?

virtualenvwrapper is a set of shell functions defined in Bourne shell compatible syntax. Its automated tests run under these shells on OS X and Linux: ... David Marble has ported virtualenvwrapper to Windows batch scripts, which can be run under Microsoft Windows Command Prompt. This is also a separately distributed re-implementation.

Is there a way to reset the environment in shell script 42?

If it's 42, the environment was not reset. There is also exec -c bash -l or exec env -i bash -l, but these are broken, somehow the $HOME variable is not set after this. Thanks, that's useful. See my edit, which does not assume bash and uses -l to ensure a login shell and uses exec so there are no nested shells. best answer!

What is the default virtualenvwrapper_hook_Dir variable?

The variable VIRTUALENVWRAPPER_HOOK_DIR tells virtualenvwrapper where the user-defined hooks should be placed. The default is $WORKON_HOME. The variable VIRTUALENVWRAPPER_LOG_FILE tells virtualenvwrapper where the logs for the hook loader should be written.

How to replace a running application/shell with a new one?

You have to replace the running application/shell with a new instance. E.g. if you are using bash as your preferred shell type the following line in your command line ( $ is the placeholder for the beginning of your command line): The running application/shell is replaced by new instance of bash like starting from scratch.


2 Answers

Solved the problem :

source /etc/bash_completion.d/virtualenvwrapper

This is where it was storing all its magic which gets included to .bashrc automatically.

like image 99
Yugal Jindle Avatar answered Oct 26 '22 17:10

Yugal Jindle


Try hash -r. It is a bash builtin.

like image 43
choroba Avatar answered Oct 26 '22 15:10

choroba