Computer Environment

Macos

Homebrew

xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

ZSH

  1. Oh-my-zsh / https://github.com/romkatv/powerlevel10k

     sudo chsh -s /bin/zsh
     sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
     git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
    
  2. Download font MesloLGS NF Regular.ttf
    • Terminal Setting
      • Apple Terminal: Open Terminal → Preferences → Profiles → Text, click Change under Font and select MesloLGS NF family.
      • GNOME Terminal (the default Ubuntu terminal): Open Terminal → Preferences and click on the selected profile under Profiles. Check Custom font under Text Appearance and select MesloLGS NF Regular.
      • Tabby (formerly Terminus): Open Settings → Appearance and set Font to MesloLGS NF.
  3. https://github.com/zsh-users/zsh-autosuggestions / https://github.com/zsh-users/zsh-syntax-highlighting

     git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
     git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
    
  4. https://github.com/dylanaraps/neofetch
    • MacOS

        brew install neofetch
      
    • Linux

        sudo apt update
        sudo apt install neofetch
      
  5. ~/.zshrc
    1. ZSH_THEME="powerlevel10k/powerlevel10k"
    2. plugins=(git zsh-syntax-highlighting zsh-autosuggestions)
    3. Optional: alias g++='g++ -std=c++20’
    4. Optional: nvcc: export PATH=/usr/local/cuda/bin:$PATH

Nvidia Driver

sudo apt update
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
# ubuntu-drivers devices
sudo apt install nvidia-driver-550 #xxxversion number
sudo reboot

或者直接一步解决:

sudo ubuntu-drivers autoinstall

Python Environment

Conda

  • MacOS

      mkdir -p ~/miniconda3
      curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -o ~/miniconda3/miniconda.sh
      bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
      rm ~/miniconda3/miniconda.sh
      ~/miniconda3/bin/conda init zsh
    
  • Linux

      mkdir -p ~/miniconda3
      wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
      bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
      rm ~/miniconda3/miniconda.sh
      ~/miniconda3/bin/conda init zsh
    

Other Package

pip install opencv-python
pip install opencv-contrib-python
pip install torch
pip install numpy
pip install pandas
pip install tqdm
pip install transformers
  • OpenCV - CUDA (Linux)

      git clone https://github.com/opencv/opencv
      git clone https://github.com/opencv/opencv_contrib
      mkdir build && cd build
      cmake -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules \
            -D BUILD_SHARED_LIBS=OFF \
            -D BUILD_TESTS=OFF \
            -D BUILD_PERF_TESTS=OFF \
            -D BUILD_EXAMPLES=OFF \
            -D WITH_OPENEXR=OFF \
            -D WITH_CUDA=ON \
            -D WITH_CUBLAS=ON \
            -D WITH_CUDNN=ON \
            -D OPENCV_DNN_CUDA=ON \
            -D CUDNN_INCLUDE_DIR=/usr/local/cuda/include \
            -D CUDNN_LIBRARY=/usr/local/cuda/lib64/libcudnn.so \
            -D BUILD_opencv_python3=ON \
            -D PYTHON_EXECUTABLE=$(which python3) \
            -D PYTHON_INCLUDE_DIR=$(python3 -c "from sysconfig import get_paths as gp; print(gp()['include'])") \
            -D PYTHON_LIBRARY=$(python3 -c "from distutils.sysconfig import get_config_var; print(get_config_var('LIBDIR'))")/libpython3.so \
            -D WITH_NVCUVID=OFF \
            -D WITH_NVCUVENC=OFF \
            ../opencv
      make -j$(nproc)
      sudo make install
      sudo ldconfig
      cp /home/david/Documents/Sonar/build/lib/python3/cv2.cpython-312-x86_64-linux-gnu.so /home/david/miniconda3/lib/python3.12/site-packages/cv2/ 
      python -c "import cv2; print(cv2.getBuildInformation())"
    

Mount Drive

  1. 获取UUID

     sudo blkid /dev/sdb
    
  2. 编辑 /etc/fstab

     sudo nano /etc/fstab
    
  3. 在文件末尾添加一行,使用 UUID 而不是设备名称来指定挂载:

     UUID=xxxx-xxxx /home/david/4tb ext4 defaults 0 2
    
  4. 重新挂载所有文件系统

     sudo mount -a
    
  5. reboot

电源问题

ACPI BIOS Error (AE_ALREADY_EXISTS)

  • 这些错误与 ACPI(高级配置和电源接口)相关,通常出现在 BIOS 与 Linux 之间的兼容性问题上。
  • AE_ALREADY_EXISTS 表示系统在初始化 PCI-E 设备(PEG1.PEGP)时,尝试创建的某个 ACPI 变量已经存在,导致失败。

解决方案

  • 更新 BIOS
    • 进入你的主板或笔记本官网,检查是否有 BIOS 更新,更新后可能会修复 ACPI 相关问题。
  • 使用 acpi=off(不推荐)
  • 尝试 acpi=strictacpi=noirq
      sudo nano /etc/default/grub
      GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi=strict"
      sudo update-grub
      sudo reboot
    



    Enjoy Reading This Article?

    Here are some more articles you might like to read next:

  • Terminal Command
  • NeRF
  • 3DGS
  • SDS
  • Pretrain Diffusion