forked from ANNIEsoft/ToolAnalysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Setup_python.sh
87 lines (80 loc) · 2.69 KB
/
Setup_python.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#checking if the numpy package is installed
if python3 -c 'import pkgutil; exit(not pkgutil.find_loader("numpy"))'; then
echo 'numpy found'
else
echo 'numpy not found - installing now...'
pip3 install numpy
fi
#checking if the pandas package is installed
if python3 -c 'import pkgutil; exit(not pkgutil.find_loader("pandas"))'; then
echo 'pandas found'
else
echo 'pandas not found - installing now...'
pip3 install pandas
fi
#checking if the tensorflow package is installed
if python3 -c 'import pkgutil; exit(not pkgutil.find_loader("tensorflow"))'; then
echo 'tensorflow found'
else
echo 'tensorflow not found - installing now...'
pip3 install --user --upgrade tensorflow
fi
#checking if the matplotlib package is installed
if python3 -c 'import pkgutil; exit(not pkgutil.find_loader("matplotlib"))'; then
echo 'matplotlib found'
else
echo 'matplotlib not found - installing now...'
pip3 install matplotlib
fi
#checking if the sklearn package is installed
if python3 -c 'import pkgutil; exit(not pkgutil.find_loader("sklearn"))'; then
echo 'sklearn found'
else
echo 'sklearn not found - installing now...'
pip3 install sklearn
fi
#creating a folder to store outputs:
if [ -d "outputs_ener" ]; then
echo "Directory outputs_ener exists."
fi
if [ ! -d "outputs_ener" ]; then
echo "Directory outputs_ener DOES NOT exist. Create a directory to store the output files from the track length in water and energy reconstruction!"
mkdir outputs_ener
fi
##########################################
#declare -a libs=(numpy pandas matplotlib)
#for i in "${libs[@]}"; do echo "$i"; done
#declare -a libs=("numpy" "pandas" "tensorflow" "matplotlib" "sklearn")
#arraylength=${#libs[@]}
#
#for (( i=0; i<${arraylength}+1; i++ ));
#do
# echo $i " / " ${arraylength} " : " ${libs[$i]}
# #pip3 install ${libs[$i]}
# if python3 -c 'import pkgutil; exit(not pkgutil.find_loader(${libs[$i]}) )'; then
# echo ${libs[$i]} " found"
# else
# echo ${libs[$i]} " not found - installing now!!!!!"
# fi
#done
#echo "------"
##checking if a package is installed
#for (( i=0; i<${arraylength}+1; i++ ));
#do
# if $i -eq 2; then
# if python3 -c 'import pkgutil; exit(not pkgutil.find_loader("${libs[$i]}") )'; then
# echo ${libs[$i]} " found"
# else
# echo ${libs[$i]} " not found - installing now..."
# #pip3 install --user --upgrade ${libs[$i]}
# fi
# echo ${libs[$i]} " installed"
# else
# if python3 -c 'import pkgutil; exit(not pkgutil.find_loader("${libs[$i]}") )'; then
# echo ${libs[$i]} " found"
# else
# echo ${libs[$i]} " not found - installing now..."
# #pip3 install ${libs[$i]}
# fi
# fi
#done