From 6aba5ad1775ae550ad6d9f87b6a1facde30bd952 Mon Sep 17 00:00:00 2001 From: pato-pan <131620424+pato-pan@users.noreply.github.com> Date: Thu, 18 Jul 2024 19:06:56 -0400 Subject: [PATCH] Update run.sh pyenv only checks for python version in the current directory now. The working directory will now always be the one where the script is located (in case you run it outside the folder, example: `./RVC/run.sh`) this also makes it so pyenv will always only show the version that applies to the current folder. I considered this alternative before coming up with this, "-qvE "3.8|`dirname -- $(readlink -fn -- "$0")`"", but this is longer and more complicated, and has the same requirements, so I discarded it. Sharing it in case someone else finds it useful --- run.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/run.sh b/run.sh index 9971503..a845808 100755 --- a/run.sh +++ b/run.sh @@ -1,5 +1,8 @@ #!/bin/sh +# Changes the working directory to the one where the bash script is located. +cd $(dirname -- $(readlink -fn -- "$0")) + if [ "$(uname)" = "Darwin" ]; then # macOS specific env: export PYTORCH_ENABLE_MPS_FALLBACK=1 @@ -17,7 +20,7 @@ else requirements_file="requirements.txt" # Check if Python 3.8 is installed - if ! command -v python3.8 >/dev/null 2>&1 || pyenv versions --bare | grep -qv "3.8"; then + if ! command -v python3.8 >/dev/null 2>&1 || pyenv version --bare | grep -qv "3.8"; then echo "Python 3 not found. Attempting to install 3.8..." if [ "$(uname)" = "Darwin" ] && command -v brew >/dev/null 2>&1; then brew install python@3.8