-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpython-prepend-3rd-packages
executable file
·48 lines (37 loc) · 1.26 KB
/
python-prepend-3rd-packages
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
#!/bin/bash
# Note:
# change this file to `python3` and put to `/path/to/python/bin/`
# make symbolic link for `python` to this file if necessary
# sys.path
#
# >> builtin modules `sys.modules`
# >+ script directory `-m` OR current directory `-c`
# >+ PYTHONPATH
# >> lib/python38.zip
# >> lib/python3.8
# >> lib/python3.8/lib-dynload
# >> .local/lib/python3.8/site-packages
# >+ .local/lib/python3.8/site-packages/zz.pth
# >> lib/python3.8/site-packages
# >+ lib/python3.8/site-packages/zz.pth
#
#
## Head
# sys.prefix #/home/xiang/Applications/miniconda3core
# sys.exec_prefix #/home/xiang/Applications/miniconda3core
#
## Tail
# lib/site-packages (Windows)
# lib/pythonX.Y/site-packages (Unix and MacOS)
a=/home/xiang/Applications/miniconda3core/envs/python38/lib/python3.8/site-packages
b=/home/xiang/Applications/miniconda3core/envs/torch/lib/python3.8/site-packages
export PYTHONPATH=$PYTHONPATH:$a:$b
now=$(realpath $0)
dir=$(dirname $now)
exec $dir/python3.8 "$@"
# Caution:
# Be aware that `/path/to/miniconda/bin/conda` depends on `python` to correctly setup
# make it to be SPECIFIC to that version of Python by changing Shebang `#!` line
#
# File : /path/to/miniconda/bin/conda
# Shebang: #!/path/to/miniconda/bin/pythonX.Y