记录一些常用的指令
Linux按照指令来关闭某个进程
nohup python -u "main.py" > log.out 2>&1 &
ps -ef|grep "python -u main.py"| awk '{print $2}'|xargs kill -9
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 install --channel https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/ pytorch torchvision cudatoolkit
conda config --set ssl_verify false pip install -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple ipykernel
python -m ipykernel install --user --name geo_torch --display-name "geo_torch"
服务器批量安装
parallel-ssh -h hosts.txt -i "/home/dell/anaconda3/bin/python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy==1.23.0"
plt.rcParams['font.sans-serif'] = ['SimHei']
docker 安装: sudo curl -fsSL https://gitee.com/tech-shrimp/docker_installer/releases/download/latest/linux.sh| bash -s docker docker 拉镜像 docker run -p 9030:9030 -p 8030:8030 -p 8040:8040 -itd --name quickstart docker.m.daocloud.io/starrocks/allin1-ubuntu 启动目录文件访问 python3 -m http.server 8000 --bind 0.0.0.0 --directory .
报错:
DataDirError: Valid PROJ data directory not found. Either set the path using the environmental variable PROJ_LIB or with `pyproj.datadir.set_data_dir`.
import os os.environ['PROJ_LIB'] = "D:\\anaconda\\envs\\geo\\Library\\share\\proj" import pyproj pyproj.datadir.get_data_dir()
查看表格需要用:
alias show_csv='python -c "import pandas as pd,sys;df=pd.read_csv(sys.argv[1]);print(df.iloc[[0,5,-5,-1]].to_string(index=False,header=True))"'
查看允许的电源策略 cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
查看现在的策略
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor | uniq
设置成高性能策略
echo 'performance' | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
查看每一个+平均平率
s=0; sm=0; n=0; for cpu in /sys/devices/system/cpu/cpu*/; do cpu_num=$(basename "$cpu" | sed 's/cpu//'); cur_freq=$(cat "${cpu}/cpufreq/scaling_cur_freq" 2>/dev/null); max_freq=$(cat "${cpu}/cpufreq/scaling_max_freq" 2>/dev/null); if [ -n "$cur_freq" ] && [ -n "$max_freq" ]; then c=$(echo "scale=2; $cur_freq / 1000" | bc); m=$(echo "scale=2; $max_freq / 1000" | bc); printf "cpu%-3s: 当前%6sMHz 最高%6sMHz\n" "$cpu_num" "$c" "$m"; s=$((s + cur_freq)); sm=$((sm + max_freq)); n=$((n + 1)); fi; done; if [ $n -gt 0 ]; then avg_cur=$(echo "scale=2; $s / $n / 1000" | bc); avg_max=$(echo "scale=2; $sm / $n / 1000" | bc); echo "--------------------------------------------------"; printf "当前均值%6sMHz\n最高均值%6sMHz\n" "$avg_cur" "$avg_max"; fi
浙公网安备 33010602011771号