Skip to content

Instantly share code, notes, and snippets.

@gayanvirajith
Created August 1, 2020 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gayanvirajith/160e46f8a4387500f31a441d81360bba to your computer and use it in GitHub Desktop.
Save gayanvirajith/160e46f8a4387500f31a441d81360bba to your computer and use it in GitHub Desktop.
Create Python 3 virtual environment using bash script
#!/bin/bash
##########
# Create python3 virtual environment
# eg: ./create-virtual-env.sh /Users/Admin/python-envrontments/my-new-project-env
# It will create new python3 virtual environment on specified path
# So later you can activate the environment by having `source /Users/Admin/python-envrontments/my-new-project-env/bin/activate`
##########
if (( $# == 0))
then
echo "Usage: ./create-virtual-env.sh path/to/folder"
exit
fi
path=$1
python3 -m venv "${path}"
echo "Virtual environment successfully created: ${path}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment