add script which can be sourced to setup the current SHELL environment

This commit is contained in:
Joel Mathew Thomas
2025-01-26 18:11:19 +05:30
parent e63513d336
commit a041e7f0ef
+23
View File
@@ -0,0 +1,23 @@
#!/bin/bash
# Define the paths for the environments
ENV_1_PATH="envs/env"
ENV_2_PATH="envs/env_tensorflow"
# Check if the environments exist
if [ ! -d "$ENV_1_PATH" ] || [ ! -d "$ENV_2_PATH" ]; then
echo "One or both environments do not exist in the 'envs/' directory."
exit 1
fi
# Activate the first environment (default)
echo "Activating environment '$ENV_1_PATH'..."
source "$ENV_1_PATH/bin/activate"
# Export PYTHONPATH to include both environments' site-packages
export PYTHONPATH="$PWD/$ENV_1_PATH/lib/python3.12/site-packages:$PWD/$ENV_2_PATH/lib/python3.12/site-packages"
echo "Environment set up successfully. PYTHONPATH set to include both environments."
# Optionally, print the current PYTHONPATH to verify
echo "PYTHONPATH=${PYTHONPATH}"