安裝anaconda
windows下直接安裝,最好勾上python加入系統路徑。
查看及安裝tensorflow依賴
查看cuda版本(機器支持gpu的不考慮)
cat /usr/local/cuda/version.txt
cuda版本及其對應tf版本:
查看python版本
python -V
安裝python環境anaconda參考[python虛擬環境安裝和配置]
安裝對應的tf版本:pip直接安裝
安裝最新版本或指定:
pip install tensorflow #pip install tensorflow==
檢測已安裝帶gpu的版本
$pip3 show tensorflow-gpu
安裝帶gpu的老版本:
pip3 install --upgrade --force-reinstall tensorflow-gpu==1.10.1
pip3 install https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.12.0-cp36-cp36m-linux_x86_64.whl
低版本下載地址在這裏[https://pypi.org/project/tensorflow-gpu/1.12.2/#files]
Note:
1 安裝的tensorflow版本要和python對應,否則出錯:tensorflow_gpu-1.12.0-cp...m-linux_x86_64.whl is not a supported wheel on this platform。
2 安裝的tensorflow版本也要和cuda版本相對應,否則出錯:tenforflow ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found stackoverflow。
3 tensorflow_gpu版本太高,如1.12,會報錯Failed to get convolution algorithm. cudnn failed to initialize…。目前版本的TensorFlow的ObjectDection中,使用tensorflow-gpu ==1.12 版本會報錯,如上,將版本降到tensorflow-gpu ==1.9.0即可正常運行。pip3 install --upgrade --force-reinstall tensorflow-gpu==1.10.1
4 tensorflow-gpu版本太低,如1.9,也會報錯:tensorflow-gpu 1.9.0 module 'tensorflow.contrib.estimator' has no attribute 'stop_if_no_increase_hook',這個模塊在1.10以上版本纔有,所以需要權衡一下再安裝。
安裝tf相關拓展包
pip install git+https://github.com/guillaumegenthial/tf_metrics.git
from: -柚子皮-
ref: