some bash commands

https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/

Ubuntu 的软件源配置文件是 /etc/apt/sources.list。将系统自带的该文件做个备份,将该文件替换为下面内容,即可使用 TUNA 的软件源镜像。

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo gedit /etc/apt/sources.list
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse

安装nvidia驱动,修改/etc/modprobe.d/blacklist.conf(https://www.cnblogs.com/medsci/p/8338101.html)

安装cuda

sudo /etc/init.d/lightdm stop
sudo sh NVIDIA-Linux-x86_64-410.73.run
sudo dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb 
sudo apt-key add /var/cuda-repo-9-0-local/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda
sudo dpkg -i cuda-repo-ubuntu1604-9-0-local-cublas-performance-update_1.0-1_amd64.deb 
sudo dpkg -i cuda-repo-ubuntu1604-9-0-local-cublas-performance-update-2_1.0-1_amd64.deb 
sudo dpkg -i cuda-repo-ubuntu1604-9-0-local-cublas-performance-update-3_1.0-1_amd64.deb 
sudo dpkg -i cuda-repo-ubuntu1604-9-0-176-local-patch-4_1.0-1_amd64.deb 

写入.bashrc
export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

sudo dpkg -i libcudnn7_7.4.1.5-1+cuda9.0_amd64.deb 
sudo dpkg -i libcudnn7-dev_7.4.1.5-1+cuda9.0_amd64.deb 
sudo dpkg -i libcudnn7-doc_7.4.1.5-1+cuda9.0_amd64.deb 
sudo apt-get install libcupti-dev

安装sogou拼音

sudo dpkg -i sogoupinyin_2.2.0.0102_amd64.deb 
sudo apt-get install -f

桌面右上角面板的开关机的按钮-系统设置- 语言支持-键盘输入方式系统中选择fcitx-注销系统用户

不行就重来一遍,在语言支持里添加sogou拼音。

禁用guest帐号:https://www.cnblogs.com/medsci/p/8337987.html

terminal自动完成:https://www.cnblogs.com/medsci/articles/9491353.html

安装并默认python3.6

sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2
sudo update-alternatives --config python3

安装virtualenv:

sudo apt-get install python-virtualenv
sudo apt-get install python-pip3 pip3
install -i https://pypi.tuna.tsinghua.edu.cn/simple virtualenv
sudo apt-get install python3.6-dev #只用python3可能会出问题
virtualenv --no-site-packages -p python3 ./gpu
source ./gpu/bin/activate
pip install --upgrade pip
......
deactivate

安装package

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple scipy
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple matplotlib
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple jupyter notebook #~/.jupyter/jupyter_notebook_config.py
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pandas
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow-gpu
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple sklearn
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple scikit-image pip install -i https://pypi.tuna.tsinghua.edu.cn/simple keras #~/.keras/keras.json
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple torch torchvision
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple fastai

 mount和umount

sudo fdisk -l
sudo mount -t ntfs /dev/sda7 /media
......
sudo umount /dev/sda7

 无法自动加载.bashrc

vim ~/.bash_profile
添加source .bashrc

双系统切换

/etc/default/grub
      GRUB_DEFAULT=0 中的 0 改为 saved
      GRUB_TIMEOUT=10 中的 10 改为 5
      在文件末尾添加 GRUB_SAVEDEFAULT=true
      保存退出
sudo update-grub
重启到启动菜单时,选择你要更改为默认启动项的系统,按 Enter 键确认启动即可,下次启动时刚刚选择的系统即为默认启动系统,直到你手动选择启动其他的系统为止。

 时间统一

ubuntu16.04:
    timedatectl set-local-rtc 1 --adjust-system-clock 
或win下
    Reg add HKLMSYSTEMCurrentControlSetControlTimeZoneInformation /v RealTimeIsUniversal /t REG_DWORD /d 1

 安装fp16

git clone https://www.github.com/nvidia/apex
cd apex
python setup.py install [--cuda_ext] [--cpp_ext]

安装skorch

pip install -U skorch   (https://github.com/dnouri/skorch)
原文地址:https://www.cnblogs.com/medsci/p/10264404.html