-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathimport_python.sh
More file actions
25 lines (22 loc) · 854 Bytes
/
import_python.sh
File metadata and controls
25 lines (22 loc) · 854 Bytes
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
# shellcheck shell=bash
# shellcheck disable=SC1090
# shellcheck disable=SC2153
# Homebrew Python
if command -v brew 1>/dev/null 2>&1; then
homebrew_python_path="$(brew --prefix)/opt/python/libexec/bin"
export PATH="$homebrew_python_path:$PATH"
fi
# Pipenv
# Depending on whether pyenv is automatically detected, the user site packages could be in different locations.
# Manually set it to the ~/.local/bin directory if it exists, otherwise use the directory python returns.
local_python_bin="$HOME/.local/bin"
if [ -d "$local_python_bin" ]; then
export PATH="$local_python_bin:$PATH"
else
if command -v python 1>/dev/null 2>&1; then
user_python_bin="$(python -m site --user-base)/bin"
export PATH="$user_python_bin:$PATH"
fi
fi
# pyenv
if command -v pyenv 1>/dev/null 2>&1; then eval "$(pyenv init -)" || true; fi