使用tensorflow遇見的坑(不斷更新!)
阿新 • • 發佈:2018-12-21
使用tensorflow遇見的坑1
坑1描述:
安裝了tensorflow-gpu版本以後,在pycharm中用樣例程式碼測試tensorflow是否安裝成功時。出現瞭如下錯誤。
直接的錯誤時:ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory
Traceback (most recent call last): File "/home/wanglei/tensorflow/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "/home/wanglei/tensorflow/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "/home/wanglei/tensorflow/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "/home/wanglei/tensorflow/lib/python3.6/imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "/home/wanglei/tensorflow/lib/python3.6/imp.py", line 343, in load_dynamic return _load(spec) ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory
原因是無法載入libcublas.so檔案,解決辦法應該在edit configurations中配置python的執行環境。加入LD_LIBRARY_PATH,設定路徑/usr/local/cuda/lib64 每次新建一個py檔案都要重新新增,好在可以直接複製,貼上。