Last active
September 5, 2024 12:06
-
-
Save jpramosi/28a46c025b3c748a349994fd9971e5cc to your computer and use it in GitHub Desktop.
Utility bash script to run python in venv.
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 | |
# pythonx init | |
# pythonx -m pip install numpy | |
# pythonx script.py | |
function on_exit { | |
deactivate | |
} | |
if [ "$1" = "init" ]; then | |
python3 -m venv .venv | |
exit 0 | |
fi | |
trap on_exit EXIT | |
source .venv/bin/activate && python3 $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment