Tensorflow2.0安装
首先建立独立的虚拟环境下安装
conda create -n tf2.0 python=3.7
conda activate tf2.0
(1)GPU版本(需要安装cudatoolkit10.0与cudnn包就可以)
pip install tensorflow-gpu==2.0.0-alpha0 #GPU版本,前期版本
conda install cudatoolkit=10.0 cudnn #GPU版本 -更新2019-10-1,也可以先不安转。
pip install tensorflow-gpu==2.0.0 -i https://pypi.tuna.tsinghua.edu.cn/simple #GPU版本 -更新2019-10-1
pip install tensorflow==2.0.0-alpha0 #CPU版本,前期版本
pip install tensorflow==2.0.0 -i https://pypi.tuna.tsinghua.edu.cn/simple #CPU版本 -更新2019-10-1
或使用
conda install tensorflow-gpu #GPU版本 -更新2019-10-1
conda install tensorflow-gpu #CPU版本 -更新2019-10-1
(2)检测是否安装成功
conda activate tf.2.0
pip install ipython
ipython
import tensorflow as tf
tf._version_
tf.test.is_gpu_available()
输出true成功
运行python检查tensorflow安装路径
tf.path
(3)卸载(如果安装错误可以卸载)
pip uninstall tensorflow-gpu==2.0.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip uninstall tensorflow-cpu==2.0.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
(4)keras,opencv和 sklearn安装
创建Anaconda3环境和激活环境
conda create -n tf2.0 python=3.7
conda activate tf2.0
conda install numpy scipy scikit-learn scikit-image matplotlib
conda install -c https://conda.anaconda.org/menpo opencv3
pi
p install keras
-U最新版