You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 16.04系统下如何卸载Caffe及其相关依赖?

Hey there, let's get your Caffe uninstalled properly since make clean only scratches the surface. Here's a step-by-step guide tailored to Ubuntu 16.04:

Step 1: Uninstall Source-Compiled Caffe

Since you tried make clean, it’s likely you compiled Caffe from source. Let’s wipe all build artifacts and the source directory entirely:

  • First, navigate to your Caffe source folder (replace ~/caffe with your actual path):
    cd ~/caffe
    
  • Run the more thorough clean command to erase all compiled files, configuration outputs, and build logs:
    make distclean
    
  • Delete the entire Caffe source directory to remove every leftover file:
    rm -rf ~/caffe
    
Step 2: Uninstall System Dependencies

Caffe relies on a host of system packages. Be cautious here—some dependencies might be used by other software, so only remove packages you’re certain you don’t need anymore:

  • List all installed packages related to Caffe and its core dependencies:
    dpkg --get-selections | grep -E "caffe|protobuf|leveldb|snappy|opencv|hdf5|atlas|gflags|glog|lmdb"
    
  • Purge the packages you want to remove (this deletes the packages and their configuration files):
    sudo apt purge libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler libatlas-base-dev libgflags-dev libgoogle-glog-dev liblmdb-dev
    
  • Clean up any unused dependencies that were installed exclusively for Caffe:
    sudo apt autoremove
    
Step 3: Remove Python Dependencies (If Applicable)

If you set up Caffe’s Python bindings or installed related packages via pip, let’s clean those up too:

  • Uninstall the Caffe Python package directly:
    pip uninstall caffe-python
    
  • If you installed packages like numpy, scipy, or matplotlib specifically for Caffe, you can uninstall them with pip uninstall <package-name>—just double-check they aren’t needed for other projects first.
Step 4: Wipe Residual Files

Finally, eliminate any leftover configuration or cache files:

  • Clear the system package cache:
    sudo apt clean
    
  • Remove system-wide Caffe configuration directories (if they exist):
    sudo rm -rf /etc/caffe
    
  • Delete user-specific Caffe cache or config files:
    rm -rf ~/.caffe
    
Note for Apt-Installed Caffe

If you installed Caffe using Ubuntu’s package manager instead of compiling from source, use these simpler commands:

sudo apt purge caffe-cpu  # Replace with caffe-gpu if you used the GPU version
sudo apt autoremove
sudo apt clean

内容的提问来源于stack exchange,提问作者Huyen

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 07:21:04