-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstall-virtualenv.sh
More file actions
executable file
·103 lines (81 loc) · 3.06 KB
/
install-virtualenv.sh
File metadata and controls
executable file
·103 lines (81 loc) · 3.06 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
set -ex
# golang 多版本环境
export GOPATH=/opt/go
export CGO_ENABLED=0
# change go version if upgrade
export GO1_25=go1.25.9
export GO1_26=go1.26.2
go install golang.org/dl/$GO1_25@latest
go install golang.org/dl/$GO1_26@latest
export HOME=/opt/go
$GOPATH/bin/$GO1_25 download && rm -rf $GOPATH/sdk/$GO1_25/$GO1_25.linux-amd64.tar.gz
$GOPATH/bin/$GO1_26 download && rm -rf $GOPATH/sdk/$GO1_26/$GO1_26.linux-amd64.tar.gz
# 清理下载器
rm -rf $GOPATH/bin/$GO1_25
rm -rf $GOPATH/bin/$GO1_26
# 软链大版本 方便升级
cd /opt/go/bin
# 项目稳定版本, 默认
ln -sf /opt/go/sdk/$GO1_25/bin/go go1.25
ln -sf /opt/go/sdk/$GO1_25/bin/go go
# golang最新稳定版
ln -sf /opt/go/sdk/$GO1_26/bin/go go1.26
ln -sf /opt/go/sdk/$GO1_26/bin/go go1
cd /opt/go/sdk
ln -sf $GO1_25 go1.25
ln -sf $GO1_25 go
ln -sf $GO1_26 go1.26
ln -sf $GO1_26 go1
# vscode golang tools, build with latest golang
# https://github.com/golang/vscode-go/blob/master/docs/tools.md
export PATH=$GOPATH/bin:$PATH
# cd hack/tools && go1 install tool
# vscode dev
go1 install golang.org/x/tools/gopls@latest
go1 install github.com/go-delve/delve/cmd/dlv@latest
go1 install github.com/golang/vscode-go/vscgo@latest
go1 install github.com/haya14busa/goplay/cmd/goplay@latest
go1 install github.com/fatih/gomodifytags@latest
go1 install github.com/josharian/impl@latest
go1 install github.com/cweill/gotests/gotests@latest
go1 install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.6.1
# protobuf
# https://github.com/protocolbuffers/protobuf-go
go1 install google.golang.org/protobuf/cmd/protoc-gen-go@v1.36.10
# https://github.com/grpc/grpc-go
go1 install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5.1
go1 install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@v2.27.3
go1 install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@v2.27.3
# my dev
go1 install golang.org/x/perf/cmd/benchstat@latest
go1 install github.com/ifooth/devcontainer/cmd/dev@v0.0.1
go1 install github.com/ifooth/devcontainer/cmd/gen-lint@v0.0.1
# 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.11
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