Use python-virtualenv to create a virtual python environment.
Select the version of Python to be created in the virtual environment:
virtualenv --python=/usr/bin/python3.1 myvirtualenv
To manage multiple virtual Python environments, install the virtualenvwrapper extension.
Why virtualenv?
The basic problem being addressed is one of dependencies and versions, and indirectly permissions. Imagine you have an application that needs version 1 of LibFoo, but another application requires version 2. How can you use both these applications? If you install everything into /usr/lib/python2.4/site-packages (or whatever your platform's standard location is), it's easy to end up in a situation where you unintentionally upgrade an application that shouldn't be upgraded.
On my version of gnome terminal
$ gnome-terminal --version
GNOME Terminal 3.22.0
I do not have option -c
, but instead I have option -x
or -e
However if you want to start gnome-terminal
running internal function sourced in .bashrc you may try to do it this way:
gnome-terminal -x "bash" -ic "irene"
Please note that bash's -i
option will make sure that your .bashrc
is evaulated, therefore irene
function is available.
Please also note, that after irene
function finishes its operation, gnome-terminal
will stop. You may consider running some commands after irene
, like for example:
gnome-terminal -x "bash" -ic "irene; sleep 2;" # wait 2 seconds after "irene" stops
or
gnome-terminal -x "bash" -ic "irene; bash;" # run NEW instance of bash after "irene" stops
If irene function sets some environmental variables, they may be accessible in this NEW instance of bash only if you export them.
function irene() {
# ...some code
export variable="value of variable"
# ...some code
}
instead of
function irene() {
# ...some code
variable="value of variable"
# ...some code
}
Best Answer
You can also use the
sys
module. Here is an example :It has the behavior your are looking for :