天天看點

To Summarize the Error of Ipython NotebookTo Summarize the Error of Ipython Notebook

To Summarize the Error of Ipython Notebook

NO.1 IOError: cannot identify image file

  • 作業系統:Ubuntu 15.04
  • 程式設計環境:python 2.7.10 + anaconda 2.3
  • 錯誤源碼:
image_root = '/home/yourself/anaconda/lib/python2.7/site-packages/PIL/'
import sys
sys.path.insert(, image_root)
import Image
im = np.array(Image.open('images/cat.jpg'))    
           
  • 錯誤提示:IOError: cannot identify image file
  • 解決方案:将上述源碼錯誤源碼中
import Image
           

改為:

from PIL import Image
           
  • 錯誤原因:

    系統中存在很多Image子產品,sys.path中也已經加入很多别的路徑,而在編譯器搜尋Image子產品時,可能同時找到很多其他的Image子產品,導緻系統不知如何選擇(或者随機選擇),故你需要指定一個Image子產品(在這裡是PIL Image 子產品)給他調用,才不會出錯,即加上from PIL(import Image)。

NO.2.build_release/tools/caffe: error while loading shared libraries: libhdf5_hl.so.10: cannot open shared object file: No such file or directory

  • 作業系統:Ubuntu 15.04
  • 程式設計環境:python 2.7.10 + anaconda 2.3
  • 錯誤源碼:
(caffe編譯指令: make runtest -j4)    
           
  • 錯誤提示:.build_release/tools/caffe: error while loading shared libraries: libhdf5_hl.so.10: cannot open shared object file: No such file or directory
  • 解決方案:終端執行如下指令:
cd ~/anaconda2/lib/
sudo cp libhdf5.so /usr/lib/x86_64-linux-gnu/
sudo cp libhdf5_hl.so /usr/lib/x86_64-linux-gnu/