当前位置:   article > 正文

code server安装使用教程_code server 安装

code server 安装

1. 安装

1.1. 下载code-server安装

类似这种文件:code-server-3.10.2-linux-amd64.tar.gz

解压:tar -xvf code-server-3.10.2-linux-amd64.tar.gz

1.2 (可选)建立软连接

ln -s path/to/code-server-3.10.2-linux-amd64/bin/code-server code-server

1.3 建立运行脚本

vim run_vscode.sh

写入如下内容,PASSWORD自己设置,最后行8445是端口号,需要网络设置。

  1. PASSWORD=your_passwod
  2. TZ=Asia/Shanghai
  3. export PASSWORD=$PASSWORD
  4. export SUDO_PASSWORD=$PASSWORD
  5. export TZ=$TZ
  6. nohup ./code-server --bind-addr=0.0.0.0:8445 &

2. 使用

启动:

nohup sh run_vscode.sh > vscode_log.txt 2>&1 &

然后可以在浏览器打开。

关闭方法:

(1)ps aux | grep code

(2)kill -9 the_pid

3. 编程插件

按需下载扩展程序:GitLens; Python;C/C++;
cpptools-linux(如需要手动安装,则先下载包,然后如下图所示)

4. 调试方法

调试前编译

在终端里用cmake编译好(可以直接使用VSCode Server里的终端,不需要另开窗口)

创建或修改调试配置

推荐cpp配置文件内容(.vscode/launch.json):

  1. {
  2. // Use IntelliSense to learn about possible attributes.
  3. // Hover to view descriptions of existing attributes.
  4. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  5. "version": "0.2.0",
  6. "configurations": [
  7. {
  8. "name": "(gdb) Launch",
  9. "type": "cppdbg",
  10. "request": "launch",
  11. "program": "your/program",
  12. "args": ["-k1 v1", "-k2 v2"],
  13. "stopAtEntry": false,
  14. "cwd": "${workspaceFolder}",
  15. "environment": [{"name":"CUDA_VISIBLE_DEVICES", "value": "4"}],
  16. "externalConsole": false,
  17. "MIMode": "gdb",
  18. "setupCommands": [
  19. {
  20. "description": "Enable pretty-printing for gdb",
  21. "text": "-enable-pretty-printing",
  22. "ignoreFailures": true
  23. }
  24. ]
  25. }
  26. ]
  27. }

推荐python分布式训练配置文件内容(.vscode/launch.json):

  1. {
  2. // Use IntelliSense to learn about possible attributes.
  3. // Hover to view descriptions of existing attributes.
  4. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  5. "version": "0.2.0",
  6. "configurations": [
  7. {
  8. "name": "Python: distributed",
  9. "type": "python",
  10. "request": "launch",
  11. "program": "path/to/env/lib/python3.7/site-packages/torch/distributed/launch.py",
  12. "console": "integratedTerminal",
  13. "env": {"CUDA_VISIBLE_DEVICES": "0"},
  14. "args": [
  15. "--nproc_per_node=1",
  16. "examples/run_funsd.py",
  17. "--model_name_or_path=microsoft/layoutlmv2-base-uncased",
  18. "--output_dir=/tmp/test-ner",
  19. "--do_train",
  20. "--do_predict",
  21. "--max_steps=1000",
  22. "--warmup_ratio=0.1",
  23. "--fp16"
  24. ],
  25. "justMyCode": false,
  26. }
  27. ]
  28. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/165346
推荐阅读
相关标签
  

闽ICP备14008679号