1. $: find /usr/bin/ -name "python*"
2. $: python --version
check the version of python
3. $: sudo apt-cache search "pip"
4. $: sudo apt install python3-pip
python2 --> python-pip
python3 --> python3-pip
5. $: pip3 install tensorflow -i https://mirrors.aliyun.com/pypi/simple
6. $: ll /usr/bin | grep "python"
7. $: ln -s /usr/bin/python3.6 python
you may remove python first if exist
about gcc
1. -g must be inserted in compiling process,eg.
gcc -g -c hello.c -o hello.o
gcc -O2 hello -o hello.exe
2.
执行时使用
gdb a
此时输入 l 显示所有的代码
l
输入b 加入断点到某一行(break)
b 108
运行代码到断点处(run)
r
此时输入s单步运行(step )
s
监视某一个变量值的变化
watch ×××
运行直到下一个暂停点(continue)
c
期间输出变量的结果 (print )
p ×××
q退出
3.
gdb 常用命令
(1) gdb 可执行文件 : 表示对某个文件进行调试
(2) b 函数名/行数 : 在某个函数名或行数前设置断点
(3) run/r : 表示开始运行,如果是正在调试的程序的话,表示再次进行调试
(4) n/next : 表示执行下一行语句
(5) l/list : 列出源码默认10行(当前位置的上下共10行)
list 行号 : 列出行号上下共10行的源码
list 函数名 : 列出函数名上下共10行的源码
(6) s/step : 表示单步执行,进入函数
(7) p /x 变量名 : 按16进制输出变量的值
/d : 按10进制
/o : 按八进制
(8) set var 变量名=值 : 设置变量的值
(9) bt(backtrace) : 查看各级函数调用及参数,简写bt
(10)q/quit : 退出
(11)finish : 连续运行到当前函数返回为止,然后停下来等待命令
(12)continue/c : 跳转到下个断点,或者跳转到观察点
(13)ptype 变量名 : 可以查看变量的类型,简写为pt
(14)watch
作用:一般用来观察某个变量/内存地址的状态(也可以是表达式),
如可以监控该变量/内存值是否被程序读/写情况。
有三种方法:
1.watch expr(指定变量/内存地址/表达式)
一旦expr的值有变化时,将停住程序。
2.rwatch expr
当expr被读时,停住程序。
3.awatch expr
当expr被读或被写时,停住程序。
watch使用步骤:
1. 使用break在要观察的变量所在处设置断点;
2. 使用run执行,直到断点;
3. 使用watch设置观察点;
4. 使用continue观察设置的观察点是否有变化。
(15)start : 开始执行程序,停在main函数第一行语句前面等待命令
(16)info watchpoints : 列出所有观察点
info breakpoints : 查看当前设置的所有断点
(17)d/delete [breakpoinsts num] [rang...]
d/delete : 删除所有断点
d/delete num : 删除breakpoints为num的断点
d/delete num1-num2 : 删除breakpoints为num1-num2的断点
(18)enable num : 启用num号断点
(19)disable num : 关闭num号断点
(20)u/until : 结束当前循环
vscode
prerun: install python compile in vscode, review https://code.visualstudio.com/docs/python/debugging
1. run ubuntu of window
2. $:cd directory
3. $:code .
4. command palette(shift+ctrl+p),typing the Python: Select Interpreter ![Uploading file..._xdhptpric]()
5. select the run view
6. Click the create a launch.json file link
7. click the button: run and debug
8. debug....
scp file from linux to windows10
1.install ssh-service in windows 10
reference website:https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_overview
2.make ssh key in linux
ssh-keygen -t rsa -C "tc.yu@moffett.ai"
3.save linux ssh key in ssh server in windows10
a.创建 authorized_keys 文件并加入公钥
在 PowerShell 中执行 notepad .ssh\authorized_keys 命令创建文本文件,把客户端的公钥复制到这个文件中并保存。
把文本文件的名称修改为 authorized_keys:
b.修改 ssh 服务的配置文件
以管理员权限打开 PowerShell,执行命令 notepad C:\ProgramData\ssh\sshd_config。
注释掉配置文件中的最后两行然后保存:
#Match Group administrators
# AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys
4.run ipconfig in powershell to get ip
5.scp resize_platform.c dell@192.168.1.130:/e:/