Further refinements to python environment start code

This commit is contained in:
Joseph Lizier 2023-07-26 15:02:58 +10:00
parent 107fabad32
commit f55737c650
2 changed files with 17 additions and 3 deletions

View File

@ -26,7 +26,9 @@ folder=jpype_env
source $folder/bin/activate
if [ $? -ne 0 ]; then
echo "Virtual environment unable to be activated" >&2
return 3 # Need return instead of exit since we're running via source
# Try return first in case this script was sourced.
return 3 2>/dev/null
exit 3
else
echo "Python environment from $folder started and activated."
fi

View File

@ -20,9 +20,21 @@
# Start the python environment (stored in folder $folder) with jpype1, numpy and others installed
# and then launch jupyter
source start_env.sh
# Name of folder to use and python commands
folder=jpype_env
echo "Started virtual environment, now starting jupyter ..."
# enter the environment
source $folder/bin/activate
if [[ "$VIRTUAL_ENV" != "" ]]
then
echo "Started virtual environment, now starting jupyter ..."
else
echo "Virtual environment not started, exiting"
# Try return first in case this script was sourced.
return 1 2>/dev/null
exit 1
fi
cd ../..
jupyter notebook