Skip to content

Instantly share code, notes, and snippets.

@ndgnuh
Last active July 6, 2023 03:47
Show Gist options
  • Save ndgnuh/865c39882dc2ec58da566da171eb51d0 to your computer and use it in GitHub Desktop.
Save ndgnuh/865c39882dc2ec58da566da171eb51d0 to your computer and use it in GitHub Desktop.
Create venv and install as app (for apps like labelme and gscreenshot)
#!/bin/sh
# Install venv first.
apppkg="$1"
appcmd="$2"
if [ -z "$apppkg" ]; then
echo "./mvenvapp.sh <apppkg> [appcmd]"
exit 1
fi
if [ -z "$appcmd" ]; then
appcmd="$apppkg"
fi
envname="$appcmd"
python3 -m venv "$envname"
activate=$(realpath "$envname/bin/activate")
proxyfile="$HOME/.local/bin/$appcmd"
echo $envname
. $activate
pip install "$apppkg"
echo "
. $activate
$appcmd \$@
" > "$proxyfile"
chmod 755 "$proxyfile"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment