create venv during installation

This commit is contained in:
Hristo Jelev
2023-12-19 18:56:30 +02:00
parent 0d303c40df
commit 11da6de994

View File

@@ -29,6 +29,20 @@ find_python(){
fi
}
create_venv(){
# Check if python3-venv is installed
if ! dpkg -l | grep -q python3-venv; then
echo "python3-venv is not installed. Installing..."
sudo apt-get install -y python3-venv
fi
# Create a virtual environment
${python} -m venv env
# Activate the virtual environment
source env/bin/activate
}
printm(){
length=$(expr length "$1")
length=$(($length + 4))
@@ -61,7 +75,7 @@ check_and_install_pip(){
install_requirements(){
printm "Installing requirements"
sudo $pip_run install --user -r requirements.txt
sudo $pip_run install -r requirements.txt
}
update_config(){
@@ -126,6 +140,7 @@ main(){
welcome
find_python
check_and_install_pip
create_venv
install_requirements
update_config
set_cron