Ubuntu常用命令(用一点记一点)

查看硬件版本信息

 

查看当前操作系统发行版信息

cat /etc/issue

查看cpu型号

cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c

查看物理CPU数

cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l

查看CPU核数

cat /proc/cpuinfo| grep "cpu cores"| uniq

查看逻辑CPU数

cat /proc/cpuinfo| grep "processor"| wc -l

 

查看CPU概要信息

lscpu

 

 

查看驱动程序信息

查看cuda版本

cuda 版本

cat /usr/local/cuda/version.txt

cudnn 版本

cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2

环境下正在使用的cuda版本:

nvcc -V 
# or
nvcc -version

 

 

 

 

Conda和pip使用

 

1 create a new environment:

conda create -n myname python==x.x

2 delete everything about an environment:

conda remove -n myname --all

3 check all the environments:

conda info -e

4 activate any env:

conda activate myname

5 check package:

conda list

6 search package:

conda search xx

7 install / update / remove / uninstall package

conda install / update xx

8 activate / deactivate env:

conda / source activate env_name

source deactivate env_name

 

set channel:

check all the chnnels:

conda config --show channels
channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  - defaults

set qinghua channel:

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 channel set:

各镜像源地址:https://www.cnblogs.com/microman/p/6107879.html

pip install pip -U

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

国内源:

  阿里云 https://mirrors.aliyun.com/pypi/simple/
  中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
  豆瓣(douban) http://pypi.douban.com/simple/
  清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
  中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/

一、Conda降级pytorch版本或安装指定版本pytorch

 

conda install pytorch=0.4.1 -c soumith
conda install pytorch=0.4.1 torchvision

二、PIP降级或安装指定版本pytorch

只提供离线安装升级降级

pip install http://download.pytorch.org/whl/torch-0.4.1.post1-cp27-none-macosx_10_7_x86_64.whl 
# 比如安装0.2.0版本
# pip install http://download.pytorch.org/whl/torch-0.2.0.post1-cp35-cp35m-macosx_10_7_x86_64.whl 
pip install torchvision 

 

三、源码安装指定版本

如果喜欢用源码编译安装,可以直接在github寻找指定版本,安装即可。

 

 

如何安装指定版本Pytorch:

#使用conda安装指定版本

conda install pytorch=0.1.10 -c soumith

#使用pip安装指定版本

pip install pytorch==0.1.10

 

然后输入即可同时安装上pytorchtorchvision

conda install pytorch=0.4.1 torchvision

 

如何查看当前pytorch版本:

import torch

print(torch.__version__)

 

把终端中所有信息都写到文本文件中的方法如下:
在执行想要保存的命令之前, 在终端的命令行中输入以下命令:
$ script -f output.txt

这样在终端的当前文件夹下就会生成output.txt文件
接下来,在按Ctrl+D(该命令是停止的意思)之前,在命令窗口执行的所有命令包括终端输出的所有信息都会写到output.txt文件中。

 

GCC/G++

1、首先需要添加ppa到本地库:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test

2、更新本地库:

sudo apt-get update

3、安装自己想要的版本:

sudo apt-get install gcc-6 g++-6

4、 gcc版本切换 手动更换软连接

sudo ln -s /usr/bin/gcc-6 /usr/bin/gcc -f
sudo ln -s /usr/bin/gcc-ar-6 /usr/bin/gcc-ar -f
sudo ln -s /usr/bin/gcc-nm /usr/bin/gcc-nm -f
sudo ln -s /usr/bin/g++-nm /usr/bin/g++-nm -f
sudo ln -s /usr/bin/g++-ar-6 /usr/bin/g++-ar -f
sudo ln -s /usr/bin/g++-6 /usr/bin/g++ -f

5、 查看gcc版本命令: gcc -v
 

Auto-Gluon安装:

# Here we assume CUDA 10.0 is installed.  You should change the number
# according to your own CUDA version (e.g. mxnet-cu101 for CUDA 10.1).
pip install --upgrade mxnet-cu100
pip install autogluon

 

Ubuntu下查看opencv版本:

查看linux下的opencv安装库:

pkg-config opencv --libs

查看linux下的opencv安装版本:

pkg-config opencv --modversion

查看linux下的opencv安装路径:

sudo find / -iname "*opencv*"

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章