Created
November 12, 2023 14:34
-
-
Save sovietspy2/f69ec25cff4c774a0ec2b536333cf746 to your computer and use it in GitHub Desktop.
create venv in current directory or activate venv is present
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Define the name for the virtual environment | |
venv_name="venv" | |
# Check if the virtual environment already exists | |
if [ -d "$venv_name" ]; then | |
echo "Activating existing virtual environment..." | |
source "$venv_name/bin/activate" | |
else | |
echo "Creating and activating a new virtual environment..." | |
python3 -m venv "$venv_name" | |
source "$venv_name/bin/activate" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment