1
0
mirror of synced 2025-02-17 11:08:33 +01:00

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
This commit is contained in:
pato-pan 2024-07-18 19:06:56 -04:00 committed by GitHub
parent c4b442c3c8
commit 6aba5ad177
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

5
run.sh
View File

@ -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