-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython.dot.sh
More file actions
88 lines (75 loc) · 2.32 KB
/
python.dot.sh
File metadata and controls
88 lines (75 loc) · 2.32 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
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
88
# Enable Pyenv
export PYTHONSTARTUP=~/.pythonstartup.py
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
#eval "$(pyenv virtualenv-init -)"
export LDFLAGS="-L/usr/local/opt/zlib/lib -L/usr/local/opt/bzip2/lib"
export CPPFLAGS="-I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include"
# virtualenvwrapper
# lazy loading saves on shell startup time
workon() {
[ -z "$PROJECT_HOME" ] && {
unset -f workon;
#export PROJECT_HOME=/server/python/;
export VIRTUALENVWRAPPER_PYTHON=$(which python3)
source /usr/local/bin/virtualenvwrapper.sh
}
workon "$@"
}
,conda() {
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/pashom2/opt/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/pashom2/opt/anaconda3/etc/profile.d/conda.sh" ]; then
. "/Users/pashom2/opt/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/pashom2/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
}
function ,pypath {
# usage: ,pypath [--prepend] [<directories>]
#
# Adds current directory or given directories to path. If --prepend not
# given, directories are appended.
#
# Also updates $_OLD_VIRTUAL_PATH set by Python's virtualenv, so that path
# changes persist through a venv deactivate command.
if [[ -z "$1" ]]; then
echo 'PYTHONPATH: '
IFS=: eval printf "%s\\\n" \$${1:-PYTHONPATH}
return 0
fi
if [[ $1 = "--prepend" ]]; then
prepend=true
paths=(${@:2})
else
prepend=false
paths=($@)
fi
if [ -z "$paths" ]; then
paths[0]=$PWD
fi
for path in "${paths[@]}"; do
# Ignore paths that don't exist
if [ ! -f "$path" ] && [ ! -d "$path" ]; then
continue
fi
fullpath="$(cd "$path"; echo $PWD)"
if [[ ":$PYTHONPATH:" != *":$fullpath:"* ]]; then
if [[ "$prepend" = true ]]; then
export PYTHONPATH="$fullpath:$PYTHONPATH"
else
export PYTHONPATH="$PYTHONPATH:$fullpath"
fi
fi
done
,pypath
}