1.建立python虛擬環境python
a.安裝anacondagit
b.conda create -n python2 python=2.7github
c.conda activate python2(進入虛擬環境)python2.7
2.進入到本身代碼的目錄執行 pip install -r requirements.txtui
3.下載模型(須要鏈接外網)this
4.執行python ./src/demo.py這時候會報錯:spa
Traceback (most recent call last):
File "./src/demo.py", line 21, in <module>
import tensorflow as tf
File "/home/supermicro/anaconda3/envs/python2.7/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/supermicro/anaconda3/envs/python2.7/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 72, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/supermicro/anaconda3/envs/python2.7/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 61, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/supermicro/anaconda3/envs/python2.7/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "/home/supermicro/anaconda3/envs/python2.7/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory
Failed to load the native TensorFlow runtime.
See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
3d
解決方法:pip install tensorflowip
再執行一次就好啦~rem
以前出現過得錯誤有的狀況是python3.5環境不少錯、本身一步步裝它所須要的依賴,也不少錯。這個步驟下來就很順暢