
linux
乱搭巴士
debug
展开
-
linux常用的编辑器命令
进入vi的命令vi filename :打开或新建文件,并将光标置于第一行首vi +n filename :打开文件,并将光标置于第n行首vi + filename :打开文件,并将光标置于最后一行首vi +/pattern filename:打开文件,并将光标置于第一个与pattern匹配的串处vi -r filename :在上次正用vi编辑时发生系统崩溃,恢复filenamevi filename…filename :打开多个文件,依次进行编辑移动光标类命令h :光标左移一个字符l转载 2021-03-30 19:58:19 · 241 阅读 · 0 评论 -
在linux系统下打印出loss和accuracy,并保存图片到本地。
import matplotlib.pyplot as pltloss_list = []accuracy_list = []def main(): loss_list = [1, 2, 3, 4] accuracy_list = [3, 2, 1, 4] x1 = range(0, 4) x2 = range(0, 4) adam_lr=0.001 epochs=400 y1 = accuracy_list y2 = loss_li原创 2021-03-29 20:01:31 · 419 阅读 · 0 评论 -
linux下离线下载安装第三方库
服务器没网时可以这样做。第三方库的网址:https://pypi.org/1.去搜索想要的包,比如matplotlib,找到对应python版本和系统版本(linux或者windows)的whl包进行下载。2.上传至liunx,我是拖拽上传的。3.安装进入对应目录whl文件:pip install paramiko-2.7.2-py2.py3-none-any.whltar.gz 文件:1)解压:tar -zxvf *.tar.gz2)进入文件目录 cd *(进入解压后的文件夹)3)运原创 2021-03-28 23:26:48 · 1791 阅读 · 1 评论 -
python安装包出现WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))
找了各自方法,换了各种源,但是还是一直提示这个。问题:其实是服务器没联网。使用命令:ping baidu.com如果不能一直收到回复就是没联网。原创 2021-03-28 22:55:49 · 740 阅读 · 0 评论 -
linux下使用screen远程连接服务器运行代码,防止断开
如果没有screen需要先下载:(没有实测这个,我的服务器上本来就有)yum install -y screen然后使用命令screen -S ty1 创建一个screen。(ty1是我取的名字)再按照普通linux系统里的操作,进入到对应目录运行代码即可。当网络掉线或者服务器断开时,使用screen -ls可以查询到后台正在运行的screen。我查到了:然后使用命令:screen -r 11136.ty1就连接上了。...原创 2021-03-28 14:23:12 · 1121 阅读 · 0 评论 -
Expected all tensors to be on the same device, but found at least two devices, cuda:3
我是在linux系统下的RTX3090,多显卡下训练的。此时有两个显卡空着所以报错如下:RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:3解决方案:先用命令:nvidia-smi查询空闲的显卡可以看出0号是空闲的,看最左边的号码。所以,运行代码时使用如下命令:CUDA_VISIBLE_DEVICES=0 python3 main.py成功运行:原创 2021-03-22 11:46:20 · 15200 阅读 · 2 评论 -
RuntimeError: CUDA error: no kernel image is available for execution on the device
原因是下载的torch和torchvision版本不是gpu版本的。解决方案:卸载torch和torchvision:pip uninstall torchpip uninstall torchvision再使用如下命令安装:pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 -f https://download.pytorch.org/whl/torch_stable.html...原创 2021-03-22 11:28:53 · 1439 阅读 · 3 评论