Last active
July 23, 2020 06:12
-
-
Save chriswayg/ee97606a4dc93a4cdacff90915d5d1e5 to your computer and use it in GitHub Desktop.
Revisions
-
chriswayg revised this gist
Jul 23, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ set -o errexit # /bin/bash -c "$(curl -fsSL https://gist.githubusercontent.com/chriswayg/ee97606a4dc93a4cdacff90915d5d1e5/raw/pythonlister.sh)" # Download, install with sudo in /usr/local/ and run the script # f=/usr/local/bin/pythonlister; sudo mkdir -p /usr/local/bin && sudo curl -sSLo $f https://gist.githubusercontent.com/chriswayg/ee97606a4dc93a4cdacff90915d5d1e5/raw/pythonlister.sh && sudo chmod +x $f && pythonlister # make sure you understand the script, before you install it with sudo. -
chriswayg revised this gist
Jul 23, 2020 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -28,6 +28,7 @@ findPython=("2.3" "2.4" "2.5" "2.6" "2.7" "3.4" "3.5" "3.6" "3.7" "3.8" "3.9" "3 #printf "\n*** Searching for Python " && echo ${findPython[@]} checkPaths=("/System/Library/Frameworks/Python.framework/Versions" \ "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions" \ "/Library/Frameworks/Python.framework/Versions" \ "$HOME/Library/Frameworks/Python.framework/Versions" \ "/usr/local/Cellar/python*/*/Frameworks/Python.framework/Versions" \ @@ -42,6 +43,9 @@ for searchPath in ${checkPaths[@]}; do /System/Library/Frameworks/Python.framework/*) installedBy="macOS in System" ;; /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/*) installedBy="Xcode CLT in Library" ;; */Library/Frameworks/Python.framework/*) installedBy="Python.org in Library" ;; -
chriswayg revised this gist
Jul 19, 2020 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -63,7 +63,7 @@ for searchPath in ${checkPaths[@]}; do #echo "- looking for python${ver}" path_of_python=$searchPath/${ver}*/bin/python${ver} if command -v $path_of_python &> /dev/null; then printf "==> $path_of_python - " && $path_of_python -V 2>&1 | head -n 4 fi done fi @@ -102,7 +102,7 @@ for searchPath in ${checkPaths[@]}; do path_of_python=$searchPath/python${ver} #echo "- looking in $path_of_python" if command -v $path_of_python &> /dev/null; then printf "${color}==> $path_of_python - ${reset}" && $path_of_python -V 2>&1 | head -n 4 fi done fi @@ -119,23 +119,23 @@ for ver in "${findPython[@]}"; do #echo "- looking for $pythonver" if command -v $pythonver &> /dev/null; then printf "${color}The command '$pythonver' will run ${reset}" && which $pythonver printf "==> Version: " && $pythonver -V 2>&1 | head -n 4 fi done if command -v pip -V &> /dev/null; then printf "${color}The command 'pip' will run ${reset}" && which pip printf "==> Version: " && pip -V 2>&1 | head -n 4 fi if command -v pip3 -V &> /dev/null; then printf "${color}The command 'pip3' will run ${reset}" && which pip3 printf "==> Version: " && pip3 -V 2>&1 | head -n 4 fi if command -v pipenv --version &> /dev/null; then printf "${color}The command 'pipenv' will run ${reset}" && which pipenv printf "==> Version: " && pipenv --version 2>&1 | head -n 4 fi printf "\n" -
chriswayg revised this gist
Jul 19, 2020 . 1 changed file with 28 additions and 16 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -94,18 +94,18 @@ for searchPath in ${checkPaths[@]}; do installedBy="Unknown" ;; esac [[ -d $searchPath/ ]] && printf "${color}*** Installed by $installedBy: ${reset}\n" if [[ -d $searchPath/ ]]; then #echo "- search path $searchPath" for ver in "${findPython[@]}"; do path_of_python=$searchPath/python${ver} #echo "- looking in $path_of_python" if command -v $path_of_python &> /dev/null; then printf "${color}==> $path_of_python - ${reset}" && $path_of_python -V || True fi done fi done printf "\n============== Listing currently activated Python versions ===============\n" findPython=("Python" "2" "2.3" "2.4" "2.5" "2.6" "2.7" "3" "3.4" "3.5" "3.6" "3.7" "3.8" "3.9" "3.10" "3.11" "3.12") @@ -122,10 +122,22 @@ for ver in "${findPython[@]}"; do printf "==> Version: " && $pythonver -V || True fi done if command -v pip -V &> /dev/null; then printf "${color}The command 'pip' will run ${reset}" && which pip printf "==> Version: " && pip -V || True fi if command -v pip3 -V &> /dev/null; then printf "${color}The command 'pip3' will run ${reset}" && which pip3 printf "==> Version: " && pip3 -V || True fi if command -v pipenv --version &> /dev/null; then printf "${color}The command 'pipenv' will run ${reset}" && which pipenv printf "==> Version: " && pipenv --version || True fi printf "\n" [[ ! -z $VIRTUAL_ENV ]] || [[ ! -z $CONDA_DEFAULT_ENV ]] && printf "${color}==> NOTE:${reset} you are running in a virtual environment! \n\n" -
chriswayg revised this gist
Jul 19, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -124,7 +124,7 @@ for ver in "${findPython[@]}"; do done printf "${color}The command 'pip' will run ${reset}" && which pip printf "==> Version: " && pip -V || True printf "${color}The command 'pip3' will run ${reset}" && which pip3 printf "==> Version: " && pip3 -V || True printf "\n" -
chriswayg revised this gist
Jul 19, 2020 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -122,6 +122,10 @@ for ver in "${findPython[@]}"; do printf "==> Version: " && $pythonver -V || True fi done printf "${color}The command 'pip' will run ${reset}" && which pip printf "==> Version: " && pip -V || True printf "${color}The command 'pip' will run ${reset}" && which pip printf "==> Version: " && pip3 -V || True printf "\n" [[ ! -z $VIRTUAL_ENV ]] || [[ ! -z $CONDA_DEFAULT_ENV ]] && printf "${color}==> NOTE:${reset} you are running in a virtual environment! \n\n" -
chriswayg revised this gist
Jul 19, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -94,8 +94,8 @@ for searchPath in ${checkPaths[@]}; do installedBy="Unknown" ;; esac [[ -d $searchPath/ ]] && printf "${color}*** Installed by $installedBy: ${reset}\n" if [[ -d $searchPath/ ]]; then #echo "- search path $searchPath" for ver in "${findPython[@]}"; do -
chriswayg revised this gist
Jul 19, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -94,7 +94,7 @@ for searchPath in ${checkPaths[@]}; do installedBy="Unknown" ;; esac printf "${color}*** Installed by $installedBy: ${reset}\n" [[ -d $searchPath/ ]] && printf "${color}*** Installed by $installedBy: ${reset}\n" if [[ -d $searchPath/ ]]; then #echo "- search path $searchPath" -
chriswayg revised this gist
Jul 19, 2020 . 1 changed file with 7 additions and 7 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -56,7 +56,7 @@ for searchPath in ${checkPaths[@]}; do ;; esac [[ -d $searchPath/ ]] && printf "${color}*** Installed by $installedBy: ${reset}" && ls $searchPath/ if [[ -d $searchPath/ ]]; then #echo "- search path $searchPath" for ver in "${findPython[@]}"; do @@ -94,8 +94,8 @@ for searchPath in ${checkPaths[@]}; do installedBy="Unknown" ;; esac printf "\n${color}*** Installed by $installedBy: ${reset}\n" [[ -d $searchPath/ ]] && printf "${color}*** Installed by $installedBy: ${reset}\n" if [[ -d $searchPath/ ]]; then #echo "- search path $searchPath" for ver in "${findPython[@]}"; do @@ -111,17 +111,17 @@ printf "\n============== Listing currently activated Python versions ======== findPython=("Python" "2" "2.3" "2.4" "2.5" "2.6" "2.7" "3" "3.4" "3.5" "3.6" "3.7" "3.8" "3.9" "3.10" "3.11" "3.12") #printf "\n*** Searching for versions of " && echo ${findPython[@]} printf "${color}*** In PATH:${reset} $PATH\n" for ver in "${findPython[@]}"; do [[ $ver == "Python" ]] && ver="" pythonver="python${ver}" #echo "- looking for $pythonver" if command -v $pythonver &> /dev/null; then printf "${color}The command '$pythonver' will run ${reset}" && which $pythonver printf "==> Version: " && $pythonver -V || True fi done printf "\n" [[ ! -z $VIRTUAL_ENV ]] || [[ ! -z $CONDA_DEFAULT_ENV ]] && printf "${color}==> NOTE:${reset} you are running in a virtual environment! \n\n" -
chriswayg revised this gist
Jul 19, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ set -o errexit color="$(tput bold; tput setaf 5)" reset="$(tput sgr0)" #clear printf "============== LIST INSTALLED PYTHON VERSIONS ON THE SYSTEM ===============\n" #printf "The script will display 'python --version' for the Python executables\n" #printf "found in the file-system and in the PATH\n" @@ -63,7 +63,7 @@ for searchPath in ${checkPaths[@]}; do #echo "- looking for python${ver}" path_of_python=$searchPath/${ver}*/bin/python${ver} if command -v $path_of_python &> /dev/null; then printf "==> $path_of_python - " && $path_of_python -V || True fi done fi -
chriswayg revised this gist
Jul 16, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
Empty file. -
chriswayg revised this gist
Jul 15, 2020 . 2 changed files with 10 additions and 11 deletions.There are no files selected for viewing
Empty file.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 charactersOriginal file line number Diff line number Diff line change @@ -11,6 +11,8 @@ set -o errexit # make sure you understand the script, before you install it with sudo. color="$(tput bold; tput setaf 5)" reset="$(tput sgr0)" clear printf "============== LIST INSTALLED PYTHON VERSIONS ON THE SYSTEM ===============\n" #printf "The script will display 'python --version' for the Python executables\n" @@ -54,7 +56,7 @@ for searchPath in ${checkPaths[@]}; do ;; esac [[ -d $searchPath/ ]] && printf "\n${color}*** Installed by $installedBy: ${reset}" && ls $searchPath/ if [[ -d $searchPath/ ]]; then #echo "- search path $searchPath" for ver in "${findPython[@]}"; do @@ -92,22 +94,20 @@ for searchPath in ${checkPaths[@]}; do installedBy="Unknown" ;; esac printf "\n${color}==> Installed by $installedBy: ${reset}\n" [[ -d $searchPath/ ]] && printf "\n${color}*** Installed by $installedBy: ${reset}\n" if [[ -d $searchPath/ ]]; then #echo "- search path $searchPath" for ver in "${findPython[@]}"; do path_of_python=$searchPath/python${ver} #echo "- looking in $path_of_python" if command -v $path_of_python &> /dev/null; then printf "${color}==> $path_of_python - ${reset}" && $path_of_python -V || True fi done fi done printf "\n============== Listing currently activated Python versions ===============\n" findPython=("Python" "2" "2.3" "2.4" "2.5" "2.6" "2.7" "3" "3.4" "3.5" "3.6" "3.7" "3.8" "3.9" "3.10" "3.11" "3.12") #printf "\n*** Searching for versions of " && echo ${findPython[@]} @@ -118,11 +118,10 @@ for ver in "${findPython[@]}"; do pythonver="python${ver}" #echo "- looking for $pythonver" if command -v $pythonver &> /dev/null; then printf "\n${color}* The command '$pythonver' will run ${reset}" && which $pythonver printf "${color}==> Version: ${reset}" && $pythonver -V || True fi done printf "\n" [[ ! -z $VIRTUAL_ENV ]] || [[ ! -z $CONDA_DEFAULT_ENV ]] && printf "NOTE: you are running in a virtual environment! \n\n" -
chriswayg revised this gist
Jul 15, 2020 . No changes.There are no files selected for viewing
-
chriswayg renamed this gist
Jul 15, 2020 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,18 @@ #!/bin/bash set -o errexit # pythonlister version 0.3 # License: MIT - (c) 2020 ChrisWayg # Run the script directly # /bin/bash -c "$(curl -fsSL https://gist.githubusercontent.com/chriswayg/ee97606a4dc93a4cdacff90915d5d1e5/raw/pythonlister.sh)" # Download, install with sudo in /usr/local/ and run the script # f=/usr/local/bin/pythonlister && sudo curl -sSLo $f https://gist.githubusercontent.com/chriswayg/ee97606a4dc93a4cdacff90915d5d1e5/raw/pythonlister.sh && sudo chmod +x $f && pythonlister # make sure you understand the script, before you install it with sudo. clear printf "============== LIST INSTALLED PYTHON VERSIONS ON THE SYSTEM ===============\n" #printf "The script will display 'python --version' for the Python executables\n" #printf "found in the file-system and in the PATH\n" -
chriswayg revised this gist
Jul 11, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -106,7 +106,7 @@ for searchPath in ${checkPaths[@]}; do fi done printf "\n" read -rsn1 -p"======== Press any key to show currently activated Python versions ========";echo findPython=("Python" "2" "2.3" "2.4" "2.5" "2.6" "2.7" "3" "3.4" "3.5" "3.6" "3.7" "3.8" "3.9" "3.10" "3.11" "3.12") #printf "\n*** Searching for versions of " && echo ${findPython[@]} -
chriswayg revised this gist
Jul 7, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ set -o errexit # /bin/bash -c "$(curl -fsSL https://gist.githubusercontent.com/chriswayg/ee97606a4dc93a4cdacff90915d5d1e5/raw/pythonfinder.sh)" # Download, install with sudo in /usr/local/ and run the script # f=/usr/local/bin/pythonfinder && sudo curl -sSLo $f https://gist.githubusercontent.com/chriswayg/ee97606a4dc93a4cdacff90915d5d1e5/raw/pythonfinder.sh && sudo chmod +x $f && pythonfinder # make sure you understand the script, before you install it with sudo. -
chriswayg revised this gist
Jul 7, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ set -o errexit # /bin/bash -c "$(curl -fsSL https://gist.githubusercontent.com/chriswayg/ee97606a4dc93a4cdacff90915d5d1e5/raw/pythonfinder.sh)" # Download, install with sudo in /usr/local/ and run the script f=/usr/local/bin/pythonfinder && sudo curl -sSLo $f https://gist.githubusercontent.com/chriswayg/ee97606a4dc93a4cdacff90915d5d1e5/raw/pythonfinder.sh && sudo chmod +x $f && pythonfinder # make sure you understand the script, before you install it with sudo. @@ -106,7 +106,7 @@ for searchPath in ${checkPaths[@]}; do fi done printf "\n" read -rsn1 -p"======== Press any key to show currently activated Python versions ========\n";echo findPython=("Python" "2" "2.3" "2.4" "2.5" "2.6" "2.7" "3" "3.4" "3.5" "3.6" "3.7" "3.8" "3.9" "3.10" "3.11" "3.12") #printf "\n*** Searching for versions of " && echo ${findPython[@]} -
chriswayg revised this gist
Jul 7, 2020 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -106,7 +106,7 @@ for searchPath in ${checkPaths[@]}; do fi done printf "\n" read -t 10 -rsn1 -p"======== Press any key to show currently activated Python versions ========";echo findPython=("Python" "2" "2.3" "2.4" "2.5" "2.6" "2.7" "3" "3.4" "3.5" "3.6" "3.7" "3.8" "3.9" "3.10" "3.11" "3.12") #printf "\n*** Searching for versions of " && echo ${findPython[@]} @@ -124,3 +124,5 @@ for ver in "${findPython[@]}"; do fi done printf "\n" [[ ! -z $VIRTUAL_ENV ]] || [[ ! -z $CONDA_DEFAULT_ENV ]] && printf "\nNOTE: you are running in a virtual environment! \n\n" -
chriswayg revised this gist
Jul 7, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ set -o errexit # Download, install with sudo in /usr/local/ and run the script f=/usr/local/bin/pythonfinder sudo curl -o $f https://gist.githubusercontent.com/chriswayg/ee97606a4dc93a4cdacff90915d5d1e5/raw/pythonfinder.sh && sudo chmod +x $f && pythonfinder # make sure you understand the script, before you install it with sudo. clear printf "============== FIND INSTALLED PYTHON VERSIONS ON THE SYSTEM ===============\n" -
chriswayg revised this gist
Jul 7, 2020 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -3,9 +3,14 @@ set -o errexit # pythonfinder version 0.3 # License: MIT - (c) 2020 ChrisWayg # Run the script directly # /bin/bash -c "$(curl -fsSL https://gist.githubusercontent.com/chriswayg/ee97606a4dc93a4cdacff90915d5d1e5/raw/pythonfinder.sh)" # Download, install with sudo in /usr/local/ and run the script f=/usr/local/bin/pythonfinder sudo curl -o $f https://gist.githubusercontent.com/chriswayg/ee97606a4dc93a4cdacff90915d5d1e5/raw/pythonfinder.sh && sudo chmod +x $f && pythonfinder # make sure you understand the script, before you istall it with sudo. clear printf "============== FIND INSTALLED PYTHON VERSIONS ON THE SYSTEM ===============\n" #printf "The script will display 'python --version' for the Python executables\n" -
chriswayg revised this gist
Jul 6, 2020 . 1 changed file with 69 additions and 68 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ set -o errexit # /bin/bash -c "$(curl -fsSL https://gist.githubusercontent.com/chriswayg/ee97606a4dc93a4cdacff90915d5d1e5/raw/pythonfinder.sh)" clear printf "============== FIND INSTALLED PYTHON VERSIONS ON THE SYSTEM ===============\n" #printf "The script will display 'python --version' for the Python executables\n" #printf "found in the file-system and in the PATH\n" @@ -26,95 +26,96 @@ checkPaths=("/System/Library/Frameworks/Python.framework/Versions" \ "/usr/local/Cellar/python*/*/Frameworks/Python.framework/Versions" \ "/Users/$(id -un)/.pyenv/versions") #echo "Check paths: ${checkPaths[@]}" # the array expansion is not double-quoted to allow filename expansion for searchPath in ${checkPaths[@]}; do case $searchPath in /System/Library/Frameworks/Python.framework/*) installedBy="macOS in System" ;; */Library/Frameworks/Python.framework/*) installedBy="Python.org in Library" ;; /usr/local/Cellar/*) installedBy="Homebrew in cellar" ;; /Users/*/.pyenv/*) installedBy="Pyenv for user" ;; *) installedBy="Unknown" ;; esac [[ -d $searchPath/ ]] && printf "\n* Installed by $installedBy: " && ls $searchPath/ if [[ -d $searchPath/ ]]; then #echo "- search path $searchPath" for ver in "${findPython[@]}"; do #echo "- looking for python${ver}" path_of_python=$searchPath/${ver}*/bin/python${ver} if command -v $path_of_python &> /dev/null; then printf ">>> $path_of_python - " && $path_of_python -V || True fi done fi done checkPaths=("/opt/local/bin" \ "/Users/$(id -un)/.pyenv/shims" \ "/Users/$(id -un)/miniconda*/bin" \ "/Users/$(id -un)/anaconda*/bin") # the array expansion is not double-quoted to allow filename expansion for searchPath in ${checkPaths[@]}; do case $searchPath in /opt/local/*) installedBy="Macports in opt" ;; /Users/*/.pyenv/*) installedBy="Pyenv in shims" ;; /Users/*/miniconda*) installedBy="Miniconda for user" ;; /Users/*/anaconda*) installedBy="Anaconda for user" ;; *) installedBy="Unknown" ;; esac [[ -d $searchPath/ ]] && printf "\n* Installed by $installedBy: \n" if [[ -d $searchPath/ ]]; then #echo "- search path $searchPath" for ver in "${findPython[@]}"; do path_of_python=$searchPath/python${ver} #echo "- looking in $path_of_python" if command -v $path_of_python &> /dev/null; then printf ">>> $path_of_python - " && $path_of_python -V || True fi done fi done printf "\n" read -rsn1 -p"======== Press any key to show currently activated Python versions ========";echo findPython=("Python" "2" "2.3" "2.4" "2.5" "2.6" "2.7" "3" "3.4" "3.5" "3.6" "3.7" "3.8" "3.9" "3.10" "3.11" "3.12") #printf "\n*** Searching for versions of " && echo ${findPython[@]} printf "** In PATH: $PATH\n" for ver in "${findPython[@]}"; do [[ $ver == "Python" ]] && ver="" pythonver="python${ver}" #echo "- looking for $pythonver" if command -v $pythonver &> /dev/null; then printf "\n* The command '$pythonver' will run " && which $pythonver printf ">>> Version: " && $pythonver -V || True fi done printf "\n" -
chriswayg revised this gist
Jul 6, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ #!/bin/bash set -o errexit # pythonfinder version 0.3 # License: MIT - (c) 2020 ChrisWayg # Run the script directly: -
chriswayg renamed this gist
Jul 6, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ set -o errexit # License: MIT - (c) 2020 ChrisWayg # Run the script directly: # /bin/bash -c "$(curl -fsSL https://gist.githubusercontent.com/chriswayg/ee97606a4dc93a4cdacff90915d5d1e5/raw/pythonfinder.sh)" clear printf "=========== FIND MOST INSTALLED PYTHON VERSIONS ON THE SYSTEM ============= \n" -
chriswayg revised this gist
Jul 6, 2020 . 1 changed file with 58 additions and 33 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ #!/bin/bash set -o errexit # find-python version 0.2 # License: MIT - (c) 2020 ChrisWayg @@ -16,29 +16,43 @@ printf "=========== FIND MOST INSTALLED PYTHON VERSIONS ON THE SYSTEM ======== # Homebrew & Pyenv https://brew.sh/ # Pyenv https://github.com/pyenv/pyenv # MacPorts https://ports.macports.org/ findPython=("2.3" "2.4" "2.5" "2.6" "2.7" "3.4" "3.5" "3.6" "3.7" "3.8" "3.9" "3.10" "3.11" "3.12") #printf "\n*** Searching for Python " && echo ${findPython[@]} checkPaths=("/System/Library/Frameworks/Python.framework/Versions" \ "/Library/Frameworks/Python.framework/Versions" \ "$HOME/Library/Frameworks/Python.framework/Versions" \ "/usr/local/Cellar/python*/*/Frameworks/Python.framework/Versions" \ "/Users/$(id -un)/.pyenv/versions") echo "Check paths: ${checkPaths[@]}" for searchPath in ${checkPaths[@]}; do case $searchPath in /System/Library/Frameworks/Python.framework/*) installedBy="macOS in System" ;; */Library/Frameworks/Python.framework/*) installedBy="Python.org in Library" ;; /usr/local/Cellar/*) installedBy="Homebrew in cellar" ;; /Users/*/.pyenv/*) installedBy="Pyenv for user" ;; *) installedBy="Unknown" ;; esac [[ -d $searchPath/ ]] && printf "\n* Installed by $installedBy: " && ls $searchPath/ if [[ -d $searchPath/ ]]; then #echo "- search path $searchPath" for ver in ${findPython[@]}; do #echo "- looking for python${ver}" path_of_python=$searchPath/${ver}*/bin/python${ver} if command -v $path_of_python &> /dev/null; then printf ">>> $path_of_python - " && $path_of_python -V || True @@ -47,26 +61,34 @@ for searchPath in ${checkPaths[@]}; do fi done checkPaths=("/opt/local/bin" \ "/Users/$(id -un)/.pyenv/shims" \ "/Users/$(id -un)/miniconda*/bin" \ "/Users/$(id -un)/anaconda*/bin") for searchPath in ${checkPaths[@]}; do case $searchPath in /opt/local/*) installedBy="Macports in opt" ;; /Users/*/.pyenv/*) installedBy="Pyenv in shims" ;; /Users/*/miniconda*) installedBy="Miniconda for user" ;; /Users/*/anaconda*) installedBy="Anaconda for user" ;; *) installedBy="Unknown" ;; esac [[ -d $searchPath/ ]] && printf "\n* Installed by $installedBy: \n" if [[ -d $searchPath/ ]]; then #echo "- search path $searchPath" for ver in ${findPython[@]}; do path_of_python=$searchPath/python${ver} #echo "- looking in $path_of_python" @@ -77,19 +99,22 @@ for searchPath in ${checkPaths[@]}; do fi done read -rsn1 -p"======================== Press any key to continue ========================";echo findPython=("Python" "2" "2.3" "2.4" "2.5" "2.6" "2.7" "3" "3.4" "3.5" "3.6" "3.7" "3.8" "3.9" "3.10" "3.11" "3.12") #printf "\n*** Searching for versions of " && echo ${findPython[@]} printf "\n** Found currently activated Python versions in PATH:\n" printf "$PATH\n" for ver in ${findPython[@]}; do [[ $ver == "Python" ]] && ver="" pythonver="python${ver}" #echo "- looking for $pythonver" if command -v $pythonver &> /dev/null; then printf "\n* running " && which $pythonver printf ">>> $pythonver - " && $pythonver -V || True fi done printf "\n" -
chriswayg revised this gist
Jul 5, 2020 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -3,6 +3,9 @@ set -o errexit # find-python version 0.2 # License: MIT - (c) 2020 ChrisWayg # Run the script directly: # /bin/bash -c "$(curl -fsSL https://gist.githubusercontent.com/chriswayg/ee97606a4dc93a4cdacff90915d5d1e5/raw/find-python.sh)" clear printf "=========== FIND MOST INSTALLED PYTHON VERSIONS ON THE SYSTEM ============= \n" #printf "The script will display 'python --version' for the Python executables\n" -
chriswayg revised this gist
Jul 5, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
Empty file. -
chriswayg created this gist
Jul 5, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,92 @@ #!/bin/bash set -o errexit # find-python version 0.2 # License: MIT - (c) 2020 ChrisWayg clear printf "=========== FIND MOST INSTALLED PYTHON VERSIONS ON THE SYSTEM ============= \n" #printf "The script will display 'python --version' for the Python executables\n" #printf "found in the file-system and in the PATH\n" # Python.org - https://www.python.org/downloads/ # Miniconda https://docs.conda.io/en/latest/miniconda.html # Homebrew & Pyenv https://brew.sh/ # Pyenv https://github.com/pyenv/pyenv # MacPorts https://ports.macports.org/ findPython=("2.3" "2.4" "2.5" "2.6" "2.7" "3.4" "3.5" "3.6" "3.7" "3.8" "3.9" "3.10" "3.11" "3.12") #printf "\n*** Searching for Python " && echo ${findPython[@]} checkPaths=("/System/Library/Frameworks/Python.framework/Versions" \ "/Library/Frameworks/Python.framework/Versions" \ "~/Library/Frameworks/Python.framework/Versions" \ "/usr/local/Cellar/python*/*/Frameworks/Python.framework/Versions" \ "/Users/$(id -un)/.pyenv/versions") installedBy=("macOS in System" \ "Python.org in Library" \ "Python.org for user" \ "Homebrew in cellar" \ "Pyenv for user") i=0 for searchPath in ${checkPaths[@]}; do [[ -d $searchPath/ ]] && printf "\n* Installed by ${installedBy[$i]}: " && ls $searchPath/ i=$i+1 if [[ -d $searchPath/ ]]; then for ver in ${findPython[@]}; do #echo "- looking for python${ver}" path_of_python=$searchPath/${ver}*/bin/python${ver} if command -v $path_of_python &> /dev/null; then printf ">>> $path_of_python - " && $path_of_python -V || True fi done fi done checkPaths=("/opt/local/bin" \ "/Users/$(id -un)/.pyenv/shims" \ "/Users/$(id -un)/miniconda*/bin" \ "/Users/$(id -un)/anaconda*/bin" \ "~/miniconda*/bin" \ "~/anaconda*/bin") installedBy=("Macports in opt" \ "Pyenv in shims" \ "Miniconda for user" \ "Anaconda for user" \ "Miniconda for user" \ "Anaconda for user") i=0 for searchPath in ${checkPaths[@]}; do [[ -d $searchPath/ ]] && printf "\n* Installed by ${installedBy[$i]}: \n" i=$i+1 if [[ -d $searchPath/ ]]; then for ver in ${findPython[@]}; do path_of_python=$searchPath/python${ver} #echo "- looking in $path_of_python" if command -v $path_of_python &> /dev/null; then printf ">>> $path_of_python - " && $path_of_python -V || True fi done fi done findPython=("Python" "2" "2.3" "2.4" "2.5" "2.6" "2.7" "3" "3.4" "3.5" "3.6" "3.7" "3.8" "3.9" "3.10" "3.11" "3.12") #printf "\n*** Searching for versions of " && echo ${findPython[@]} printf "\n** Found currently activated Python versions in PATH:\n" printf "$PATH\n\n" for ver in ${findPython[@]}; do [[ $ver == "Python" ]] && ver="" pythonver="python${ver}" #echo "- looking for $pythonver" if command -v $pythonver &> /dev/null; then printf ">>> $pythonver - " && $pythonver -V || True which $pythonver fi done printf "\n"