-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunc_python.sh
More file actions
56 lines (52 loc) · 1.33 KB
/
func_python.sh
File metadata and controls
56 lines (52 loc) · 1.33 KB
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
#!/bin/bash
# -----------------
# Set up Python.
# -----------------
set_pyenv()
{
if type "pyenv" > /dev/null 2>&1; then
echo "'pyenv' is already installed."
else
if [ "$INSTALL_MODE" = "$install_apt" ] ; then
git clone "https://github.com/pyenv/pyenv.git" "${HOME}/.pyenv"
else
brew install 'pyenv'
fi
fi
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
pyenv install -s '3.13.5'
pyenv global '3.13.5'
eval "$(pyenv init -)"
pip install --upgrade 'pip'
local pip_installs=(
'autopep8'
'black'
'pylint'
)
pip install --upgrade ${pip_installs[@]}
}
set_pipenv()
{
if type "pipenv" > /dev/null 2>&1; then
echo "'pipenv' is already installed."
else
if [ "$INSTALL_MODE" = "$install_apt" ] ; then
sudo apt-get install -y 'pipenv'
else
brew install 'pipenv'
fi
fi
}
set_poetry()
{
if type "poetry" > /dev/null 2>&1; then
echo "'poetry is already installed."
else
curl -sSL "https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py" | python
export PATH="$HOME/.poetry/bin:$PATH"
poetry config virtualenvs.in-project true
fi
}