I set up an python environment in path \pyenv\1st\
by
cd /
mkdir pyenv
python3 -m venv /pyenv/1st
The official method to activate this environment is to type this command manually:
. /pyenv/1st/bin/activate
or source /pyenv/1st/bin/activate
,
which will result in (1st)
in front of prompt and load corresponding python libraries.
I want to save typing and put this command in a file mypy
, but sh mypy
won't change the current terminal to the 1st
python environment as I manually type that command. Add that command to \etc\bashrc
won't help either. I heard that the source
command will end in the subprocess like sh mypy
but won't affect the terminal at all.
Can anyone solve this problem? Either a simple command or automatically load that environment as I open a terminal will help. Thanks in advance.
just like you have to source the
activate
script to activate it, you need to do the same with the script calling it.