环境配置

上传Github

配置信息

1
2
git config user.name "您的名字"
git config user.email "您的邮箱"

初始化Git

1
git init

添加文件

1
git add .

提交

1
git commit -m "Initial commit: code"

添加远程仓库(替换为您的仓库地址)

1
2
git remote add origin https://github.com/您的用户名/仓库名.git

例如

1
git remote add origin https://github.com/chandlerye/仓库名.git

推送代码

1
2
git branch -M main
git push -u origin main

上传Github大文件(release)

使用 winget

1
winget install --id GitHub.cli

安装完成后,重新打开终端,然后:

1
2
gh auth login
gh release create v1.0.0 release/win-unpacked.zip --title "v1.0.0" --notes "首次发布 - Windows 可执行文件"

POWERSHELL(管理员) 创建软连接

1
2
New-Item -ItemType SymbolicLink -Path 
"C:\Users\Administrator\Documents\LocalWork\code" -Target "C:\Program Files (x86)\code"

代理服务器设置

windows

1
2
3
4
5
6
set HTTP_PROXY=http://127.0.0.1:7890
set HTTPS_PROXY=http://127.0.0.1:7890

set HTTP_PROXY=http://127.0.0.1:1080
set HTTPS_PROXY=http://127.0.0.1:1080

ubuntu

1
2
3
4
5
export http_proxy=socks5://127.0.0.1:1080
export https_proxy=socks5://127.0.0.1:1080

export http_proxy=http://127.0.0.1:7890
export http_proxys=http://127.0.0.1:7890

Ubuntu anaconda环境变量设置

1
2
3
4
5
sudo gedit ~/.bashrc

export PATH="~/anaconda3/bin":$PATH

source ~/.bashrc

Ubuntu cuda环境变量设置

1
2
3
4
5
6
7
8
9
sudo nano ~/.bashrc

export PATH=/usr/local/cuda/bin:$PATH

export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

source ~/.bashrc

nvcc --version

换conda清华源

1
2
3
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes

换pip清华源

1
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

Ubuntu22.04 开启3389端口远程连接

1
2
firewall-cmd --add-port=3389/tcp --permanent
firewall-cmd --reload

vscode python调试功能的launch.json配置设置

参数配置
工作区Python路径设置

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
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Run Image Detection Demo",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/demo/image_demo.py",
"console": "integratedTerminal",
"args": [ // 参数设置
"demo/demo.jpg",
"configs/mask_rcnn/mask-rcnn_r101_fpn_1x_coco.py",
"--weights",
"mymodel/mask_rcnn_r101_fpn_1x_coco_20200204-1efe0ed5.pth",
"--texts",
"bench",
"--device",
"cuda:0"
],
"env": {
"PYTHONPATH": "${workspaceFolder}" // 关键设置:将工作区路径添加到PYTHONPATH
},
}
]
}

vscode python调试功能的settings.json配置设置

1
2
3
{
"python.analysis.extraPaths": ["./mycode"] //本地模块添加
}

linux配置免密登录

本机运行

1
ssh-keygen -t rsa

将本机.SSH文件夹下的id_rsa.pub追加到远程主机.ssh文件夹下的authorized_keys文件中

1
cat id_rsa.pub >> authorized_keys

screen命令 挂起窗口

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 新建窗口
screen -S name

# 挂起 [detached]
ctrl + a + d

# 列出窗口列表
screen -ls

# 杀死多余窗口
kill -9 threadnum

# 清除死去的窗口
screen -wipe

nignx正向代理配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#正向代理转发http请求 
server {
#指定DNS服务器IP地址
# resolver 114.114.114.114;
#监听80端口,http默认端口80
listen 80;
#服务器IP或域名
server_name xxx.xxxxx.top;

#正向代理转发http请求
location / {
proxy_pass http://xxxxx.top:20003;
proxy_set_header HOST $host;
proxy_buffers 256 4k;
proxy_max_temp_file_size 0k;
proxy_connect_timeout 30;
proxy_send_timeout 60;
proxy_read_timeout 60;
proxy_next_upstream error timeout invalid_header http_502;
}
}

windows指令

Windows转发wsl

1
2
3
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=7777 connectaddress=localhost connectport=8888
netsh interface portproxy show all
netsh interface portproxy delete v4tov4 listenport=7777 listenaddress=0.0.0.0 protocol=tcp