Ubuntu使用

Anaconda使用

  • 创建环境:
conda create -n pytorch python=3.7
  • 删除环境:
conda remove --name pytorch --all
  • 完全卸载Anaconda(Windows下参考
conda install anaconda-clean
anaconda-clean --yes
  • 添加conda源(Windows也可用)参考
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
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
  • 删除conda源:
conda config --remove-key channels
  • 修改默认conda环境变量(:wq保存退出):
vi ~/.bashrc

pytorch下载地址:https://download.pytorch.org/whl/torch_stable.html

创建用户

ubuntu创建用户
ubuntu添加sudo权限

查看IP

ip addr show

关闭指定端口

sudo ufw deny

pip使用

添加pip源:

  • 指定安装源,安装opencv模块,单次有效
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python

国内源:

豆瓣:
https://pypi.doubanio.com/simple/
阿里云 :
https://mirrors.aliyun.com/pypi/simple/
  • 修改配置文件,永久有效

Linux下,修改 ~/.pip/pip.conf (没有则创建)
内容如下:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com

windows下,win+R 打开用户目录%HOMEPATH%,在此目录下创建 pip 文件夹,在 pip 目录下创建 pip.ini 文件, 内容如下:

[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn

修改host

sudo gedit /etc/hosts

刷新DNS

sudo /etc/init.d/networking restart

压缩命令

  • pigz

压缩速度快,多线程压缩命令如下:

tar -cvf - face_image/ | pigz -p 8 > face_image_p4.tar.gz

解压命令:

tar --use-compress-program="pigz -dk -p8" -xf train_img.tar.gz 
  • zip

path:/home/user/folder/test

cd /home/user/folder/
zip -r test.zip test/

解压压缩包中的1个文件夹:

unzip oulu-face-pair.zip 'oulu-face-pair/P001/*' -d test-ou

其中oulu-face-pair.zip为压缩包,P001为压缩包中的一个文件夹,test-ou为解压后输出的路径。

查看压缩包里文件结构:

unzip -l test.zip
  • mv

mv:移动文件(夹)到指定目录

mv path dst-path
  • cp

cp:复制文件(夹)到指定目录

mv path dst-path

复制时显示进度命令:

rsync -ah --progress path dst-path
  • 查看内存
free -mh
  • 删除
rm -rf 文件夹
  • tar

tar zxvf  文件名.tgz
  • 存储空间(查看指定路径文件夹大小)
du -B G --max-depth=1 path(路径)

数据集

伯克利无人驾驶BDD地址:BDD-100k

  • 下载Tip

可以使用IDM使用方法教程进行下载,pan下载例子以及2019年IDM-install

显存释放

在ubuntu使用kill -9 PID杀死后台训练程序时,可能会出现不释放显存的情况,可以使用

fuser -v /dev/nvidia*

查看GPU上的进程,然后kill -9 PID即可。也可以直接使用:

pkill -9 -U username

杀死指定用户的所有进程。

批量重命名

在excl表中输入以下命令:

="REN?"&A1&"?"&B1&""

win10环境变量

原始Path(避免被覆盖,特此记录)如下:

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;

opencv读取视频

在ubuntu下使用opencv读取视频时,capture.isOpened() 可能为False,运行:

pip install opencv-contrib-python

即可解决问题(参考isOpened()

Cmake使用

cmake学习:https://github.com/Akagi201/learning-cmake
https://github.com/wzpan/cmake-demo
https://www.hahack.com/codes/cmake/
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值