Merge pull request #5271 from samgermain/setup-mac-fix
setup.sh mac fix
This commit is contained in:
commit
708d5691b0
68
setup.sh
68
setup.sh
@ -17,35 +17,20 @@ function check_installed_python() {
|
||||
exit 2
|
||||
fi
|
||||
|
||||
which python3.8
|
||||
for v in 8 9 7
|
||||
do
|
||||
PYTHON="python3.${v}"
|
||||
which $PYTHON
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "using Python 3.8"
|
||||
PYTHON=python3.8
|
||||
echo "using ${PYTHON}"
|
||||
|
||||
check_installed_pip
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
which python3.9
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "using Python 3.9"
|
||||
PYTHON=python3.9
|
||||
check_installed_pip
|
||||
return
|
||||
fi
|
||||
|
||||
which python3.7
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "using Python 3.7"
|
||||
PYTHON=python3.7
|
||||
check_installed_pip
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ -z ${PYTHON} ]; then
|
||||
echo "No usable python found. Please make sure to have python3.7 or newer installed"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function updateenv() {
|
||||
@ -122,6 +107,25 @@ function install_talib() {
|
||||
cd ..
|
||||
}
|
||||
|
||||
function install_mac_newer_python_dependencies() {
|
||||
|
||||
if [ ! $(brew --prefix --installed hdf5 2>/dev/null) ]
|
||||
then
|
||||
echo "-------------------------"
|
||||
echo "Installing hdf5"
|
||||
echo "-------------------------"
|
||||
brew install hdf5
|
||||
fi
|
||||
|
||||
if [ ! $(brew --prefix --installed c-blosc 2>/dev/null) ]
|
||||
then
|
||||
echo "-------------------------"
|
||||
echo "Installing c-blosc"
|
||||
echo "-------------------------"
|
||||
brew install c-blosc
|
||||
fi
|
||||
}
|
||||
|
||||
# Install bot MacOS
|
||||
function install_macos() {
|
||||
if [ ! -x "$(command -v brew)" ]
|
||||
@ -131,8 +135,13 @@ function install_macos() {
|
||||
echo "-------------------------"
|
||||
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
fi
|
||||
#Gets number after decimal in python version
|
||||
version=$(egrep -o 3.\[0-9\]+ <<< $PYTHON | sed 's/3.//g' )
|
||||
|
||||
if [[ $version -ge 9 ]]; then #Checks if python version >= 3.9
|
||||
install_mac_newer_python_dependencies
|
||||
fi
|
||||
install_talib
|
||||
test_and_fix_python_on_mac
|
||||
}
|
||||
|
||||
# Install bot Debian_ubuntu
|
||||
@ -189,19 +198,6 @@ function reset() {
|
||||
updateenv
|
||||
}
|
||||
|
||||
function test_and_fix_python_on_mac() {
|
||||
|
||||
if ! [ -x "$(command -v python3.6)" ]
|
||||
then
|
||||
echo "-------------------------"
|
||||
echo "Fixing Python"
|
||||
echo "-------------------------"
|
||||
echo "Python 3.6 is not linked in your system. Fixing it..."
|
||||
brew link --overwrite python
|
||||
echo
|
||||
fi
|
||||
}
|
||||
|
||||
function config() {
|
||||
|
||||
echo "-------------------------"
|
||||
|
Loading…
Reference in New Issue
Block a user