28 lines
771 B
Bash
Executable File
28 lines
771 B
Bash
Executable File
#!/bin/bash
|
|
envFolder=".venv"
|
|
|
|
init_venv() {
|
|
if [ ! -d "$PWD/$envFolder" ]; then
|
|
echo "Initializing virtual environment..."
|
|
python3 -m venv "$PWD/$envFolder"
|
|
#update_pip
|
|
fi
|
|
}
|
|
|
|
update_pip() {
|
|
if [ -f "$PWD/$envFolder/bin/pip" ]; then
|
|
echo "Updating pip..."
|
|
"$PWD/$envFolder/bin/python" -m pip install --upgrade pip >> /dev/null
|
|
fi
|
|
if [ -f "$PWD/requirements.txt" ]; then
|
|
echo "Installing modules..."
|
|
"$PWD/$envFolder/bin/python" -m pip install -r "$PWD/requirements.txt" >> /dev/null
|
|
else
|
|
echo "No requirements found, installing pip-autoremove..."
|
|
"$PWD/$envFolder/bin/python" -m pip install "pip-autoremove" >> /dev/null
|
|
"$PWD/$envFolder/bin/python" -m pip freeze > "$PWD/requirements.txt"
|
|
fi
|
|
}
|
|
|
|
init_venv
|
|
jupyter lab |