I'm using the Ubuntu app in windows 10 and I'm running into a problem when trying to start the Python environment from a script.
I've installed python and i can run python scripts when i set my environment from the command line but when I try and set it using a script nothing changes.
I can run this from my command line fine:
source /home/bootys/environments/my_env/bin/activate
But when I run the same thing in a script nothing changes:
#!/bin/bash
echo "Setting to Python Environment"
source /home/bootys/environments/my_env/bin/activate
if [ $? -eq 0 ]
then
echo "Environment has been set to Python"
else
echo "Failed to set environment"
fi
I'm expecting to see my environment being set to this, which is what happens when it is run from the command line:
(my_env) bootys@ThisPC:~/MyScripts$
But nothing changes even though the exit status check returns successful.
Is the script run in a sub shell? If so whats the practice to source my environment from a script?