-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path04-python-setup.sh
executable file
·63 lines (50 loc) · 2.06 KB
/
04-python-setup.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
#!/bin/bash
set -e
echo "====================================================="
echo "Setting up Python environment with Conda..."
echo "====================================================="
# Install Miniconda (smaller footprint than Anaconda)
brew install --cask miniconda
# Initialize Conda for shell integration
CONDA_PATH="$(brew --prefix)/Caskroom/miniconda/base"
"$CONDA_PATH/bin/conda" init zsh
# Create separate environments for different workflows
#echo "Creating Python environments..."
# Environment for Django development
#"$CONDA_PATH/bin/conda" create -y -n django python=3.12 django
#echo "Created Django environment. Activate with: conda activate django"
# Environment for MLX and LLMs
#"$CONDA_PATH/bin/conda" create -y -n ml python=3.12
#"$CONDA_PATH/bin/conda" activate ml
#"$CONDA_PATH/bin/conda" install -y -c conda-forge pip
# Install MLX (Apple's ML framework)
#echo "Installing MLX framework in ML environment..."
#"$CONDA_PATH/bin/pip" install mlx
# Install common ML packages
#"$CONDA_PATH/bin/pip" install numpy pandas matplotlib jupyter
#echo "Created ML environment. Activate with: conda activate ml"
# Add Conda configuration to conda.sh
if [ ! -f ~/code/scripts/conda.sh ] || ! grep -q "Conda Configuration" ~/code/scripts/conda.sh; then
cat > ~/code/scripts/conda.sh << 'EOF'
#!/bin/bash
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/homebrew/Caskroom/miniconda/base/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" ]; then
. "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh"
else
export PATH="/opt/homebrew/Caskroom/miniconda/base/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
EOF
else
echo "Conda configuration already exists."
fi
echo "====================================================="
echo "Python environment setup with Conda complete!"
echo "====================================================="