-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall-virtualenv.sh
executable file
·96 lines (76 loc) · 2.92 KB
/
install-virtualenv.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
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
89
90
91
92
93
94
95
96
#!/bin/bash
set -ex
# golang 多版本环境
export GOPATH=/opt/go
export CGO_ENABLED=0
# change go version if upgrade
export GO1_20=go1.20.14 # 当前版本
export GO1_23=go1.23.2
go install golang.org/dl/$GO1_20@latest
go install golang.org/dl/$GO1_23@latest
export HOME=/opt/go
$GOPATH/bin/$GO1_20 download && rm -rf $GOPATH/sdk/$GO1_20/$GO1_20.linux-amd64.tar.gz
$GOPATH/bin/$GO1_23 download && rm -rf $GOPATH/sdk/$GO1_23/$GO1_23.linux-amd64.tar.gz
# 清理下载器
rm -rf $GOPATH/bin/$GO1_20
rm -rf $GOPATH/bin/$GO1_23
# 软链大版本 方便升级
cd /opt/go/bin
ln -sf /opt/go/sdk/$GO1_20/bin/go go1.20
ln -sf /opt/go/sdk/$GO1_23/bin/go go1.23
ln -sf /opt/go/sdk/$GO1_23/bin/go go
cd /opt/go/sdk
ln -sf $GO1_20 go1.20
ln -sf $GO1_23 go1.23
ln -sf $GO1_23 go
# vscode golang tools, build with latest golang
# https://github.com/golang/vscode-go/blob/master/docs/tools.md
export PATH=$GOPATH/bin:$PATH
# vscode dev
go install golang.org/x/tools/gopls@latest
go install github.com/go-delve/delve/cmd/dlv@latest
go install github.com/golang/vscode-go/vscgo@latest
go install github.com/haya14busa/goplay/cmd/goplay@latest
go install github.com/fatih/gomodifytags@latest
go install github.com/josharian/impl@latest
go install github.com/cweill/gotests/gotests@latest
go install github.com/golangci/golangci-lint/cmd/[email protected]
# protobuf
# https://github.com/protocolbuffers/protobuf-go
go install google.golang.org/protobuf/cmd/[email protected]
# https://github.com/grpc/grpc-go
go install google.golang.org/grpc/cmd/[email protected]
go install github.com/grpc-ecosystem/grpc-gateway/v2/[email protected]
go install github.com/grpc-ecosystem/grpc-gateway/v2/[email protected]
# my dev
go install golang.org/x/perf/cmd/benchstat@latest
go install github.com/ifooth/devcontainer/cmd/[email protected]
go install github.com/ifooth/devcontainer/cmd/[email protected]
# clean cache
rm -rf /opt/go/pkg
rm -rf /opt/go/.cache
# pyenv python 多版本环境
export UV_PYTHON_INSTALL_DIR=/opt/python/versions
export UV_LINK_MODE=copy
export UV_NO_CACHE="1"
# change python version if upgrade
export PY3_12=3.12.7
uv python install $PY3_12
# 硬链接大版本 方便升级
cd /opt/python
cp -lr /opt/python/versions/cpython-${PY3_12}-linux-x86_64-gnu py${PY3_12}
cp -lr py${PY3_12} py3.12
cp -lr py${PY3_12} py3
uv venv notebook -p /opt/python/py3.12/bin/python
source ./notebook/bin/activate
# vscode python tools, notebook & utils
uv pip install pip ruff ipython ipdb arrow openpyxl pandas requests \
jupyterlab jupyterlab-lsp jupyterlab-widgets jupyterlab-git jupyterlab_code_formatter python-lsp-ruff matplotlib sympy
# 添加环境变量等
echo "" >> /root/.bashrc
cat /opt/root/.bashrc_append.sh >> /root/.bashrc
# Clean up & Package root dir
rm -rf /tmp/*
rsync -avz /opt/root/ /root
cd /root && rm -rf .oh-my-zsh .wget-hsts .python_history .cache .zshrc.pre-oh-my-zsh && ls -la /root
cd / && tar -zcf root.tar.gz root