解決ImportError:libSM.so.6:cannot open shared object file:No such file or directory等問題通用方案

在使用Ubuntu系統下運行代碼,常常會碰到這樣的問題:

ImportError:libSM.so.6:cannot open shared object file:No such file or directory

ImportError:libXrender.so.1:cannot open shared object file:No such file or directory

基本都是ImportError:libxxx.so.x.....之類的,缺少共享文件庫

通用的解決辦法如下,以後類似的問題都可以這樣解決:

# 安裝apt-file
sudo apt-get update

sudo apt-get install apt-file

sudo apt-file update

 

# 使用apt-file來尋找缺少的庫文件
sudo apt-file search libXrender.so.1

搜索之後會出現如下提示:

表示libxrender1中包含了缺失的這個庫,於是安裝這個

sudo apt-get install libxrender1

這樣缺失的庫就補齊了

apt-file是Ubuntu用來查找依賴的強大工具,還可以查看包中的文件

sudo apt-file list libxrender1

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章