Created
August 1, 2020 17:55
-
-
Save gayanvirajith/160e46f8a4387500f31a441d81360bba to your computer and use it in GitHub Desktop.
Create Python 3 virtual environment using bash script
This file contains 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 | |
########## | |
# 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