如果你是经常使用开源软件,你一定是经常遇到各种环境不兼容的问题,在你进行开发或者直接使用别人的库之前,检查系统和软件的当前版本是相当必要的。本文总结了linux环境下的各种版本检查命令,建议收藏或者记住。
常用检查Linix系统版本命令
检查LInux发行版
以下是在jetson nano上检查系统版本的效果,树莓派,centos, redhat或Fedora之类的发型板同样适用。
cat /etc/os-release
检查内核版本
方法1: 查询计算机名,内核版本和cpu类型
uname -a
方法2: 查看/proc/version文件内容,除了看到内核版本,也能查到gcc的版本
cat /proc/version
检查debian版本
# cat /etc/debian_version
buster/sid
检查cpu数量和频率
以下是Jetson Nano 4核的cpu信息(只显示第一个cpu)
# cat /proc/cpuinfo
processor : 0
model name : ARMv8 Processor rev 1 (v8l)
BogoMIPS : 38.40
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x1
CPU part : 0xd07
CPU revision : 1
...
以下是64核cpu的cpu信息(只显示第一个cpu)
# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 79
model name : Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz
stepping : 1
microcode : 0xb00001e
cpu MHz : 1200.146
cache size : 35840 KB
physical id : 0
siblings : 28
core id : 0
cpu cores : 14
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 20
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 invpcid_single intel_ppin intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts
bogomips : 4788.74
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
...
检查内存详情
以下是Jetson Nano 4G版本的内存信息
# cat /proc/meminfo
MemTotal: 4059468 kB
MemFree: 425136 kB
MemAvailable: 2698648 kB
Buffers: 50460 kB
Cached: 2317192 kB
SwapCached: 468 kB
Active: 1192948 kB
Inactive: 1899184 kB
Active(anon): 335376 kB
Inactive(anon): 421748 kB
Active(file): 857572 kB
Inactive(file): 1477436 kB
Unevictable: 12028 kB
Mlocked: 0 kB
SwapTotal: 8253756 kB
SwapFree: 7885420 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 728620 kB
Mapped: 52936 kB
Shmem: 20616 kB
Slab: 185604 kB
SReclaimable: 99460 kB
SUnreclaim: 86144 kB
KernelStack: 6960 kB
PageTables: 9748 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 10283488 kB
Committed_AS: 3433264 kB
VmallocTotal: 263061440 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
AnonHugePages: 342016 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
NvMapMemFree: 20500 kB
NvMapMemUsed: 86920 kB
CmaTotal: 475136 kB
CmaFree: 235036 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
以下是64G服务器的内存信息
# cat /proc/meminfo
MemTotal: 65679364 kB
MemFree: 1500856 kB
MemAvailable: 26445960 kB
Buffers: 3692 kB
Cached: 26300444 kB
SwapCached: 134368 kB
Active: 30162692 kB
Inactive: 29574972 kB
Active(anon): 24697672 kB
Inactive(anon): 10713764 kB
Active(file): 5465020 kB
Inactive(file): 18861208 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 7999484 kB
SwapFree: 5764756 kB
Dirty: 220 kB
Writeback: 0 kB
AnonPages: 33337604 kB
Mapped: 410340 kB
Shmem: 1977724 kB
Slab: 1642160 kB
SReclaimable: 1115900 kB
SUnreclaim: 526260 kB
KernelStack: 88304 kB
PageTables: 334244 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 40839164 kB
Committed_AS: 55431664 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 520412 kB
VmallocChunk: 34325346300 kB
Percpu: 116992 kB
HardwareCorrupted: 0 kB
AnonHugePages: 1275904 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 759740 kB
DirectMap2M: 33722368 kB
DirectMap1G: 34603008 kB
检查GPU信息
# nvidia-smi
+-----------------------------------------------------------------------------+
![nvidia-smi] (https://makeronsite.com/wp-content/uploads/2022/07/image-1659187117724.png)
常用的软件版本检查命令(人工智能相关)
检查cuda版本
# nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Mon_Mar_11_22:13:24_CDT_2019
Cuda compilation tools, release 10.0, V10.0.326
检查opencv版本
# python3 -c 'import cv2; print(cv2.__version__)'
4.5.5
检查opencv安装配置
python3 -c "import cv2; print(cv2.getBuildInformation())"
检查tensorflow版本
# python3 -c 'import tensorflow as tf; print(tf.__version__)'
2022-07-30 12:54:59.519604: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.10.2
WARNING:tensorflow:Deprecation warnings have been disabled. Set TF_ENABLE_DEPRECATION_WARNINGS=1 to re-enable them.
1.15.5
检查TensorRT版本
以下例子是TensorRT是6.0.1的版本
# dpkg -l | grep nvinfer
ii libnvinfer-bin 6.0.1-1+cuda10.0 arm64 TensorRT binaries
ii libnvinfer-dev 6.0.1-1+cuda10.0 arm64 TensorRT development libraries and headers
ii libnvinfer-doc 6.0.1-1+cuda10.0 all TensorRT documentation
ii libnvinfer-plugin-dev 6.0.1-1+cuda10.0 arm64 TensorRT plugin libraries
ii libnvinfer-plugin6 6.0.1-1+cuda10.0 arm64 TensorRT plugin libraries
ii libnvinfer-samples 6.0.1-1+cuda10.0 all TensorRT samples
ii libnvinfer6 6.0.1-1+cuda10.0 arm64 TensorRT runtime libraries
ii python-libnvinfer 6.0.1-1+cuda10.0 arm64 Python bindings for TensorRT
ii python-libnvinfer-dev 6.0.1-1+cuda10.0 arm64 Python development package for TensorRT
ii python3-libnvinfer 6.0.1-1+cuda10.0 arm64 Python 3 bindings for TensorRT
ii python3-libnvinfer-dev 6.0.1-1+cuda10.0 arm64 Python 3 development package for TensorRT
检查PyTorch版本
如果是检查python环境的版本,通常是先import了对应的包,然后打印出版本信息。
# python3 -c "import torch; print(torch.__version__);"
1.9.0
检查JetPack 版本(适用于Jetson系列开发板)
cat /etc/nv_tegra_release
# R32 (release), REVISION: 6.1, GCID: 27863751, BOARD: t210ref, EABI: aarch64, DATE: Mon Jul 26 19:20:30 UTC 2021