Conda配置Tensorflow运行环境

环境

  • CentOS7

安装Conda

Conda_Linux

  1. 下载Anaconda3-xxx-Linux-x86_64.sh
  2. 安装
$	sudo bash Anaconda3-xxx-Linux-x86_64.sh
  1. 使环境生效
$	source ~/.bashrc

Conda创建独立环境

  • 创建新环境 conda create -n xxx python=3.7.6
  • 查看已有环境 conda info -e conda info --envs
  • 复制已有环境 conda create -n xxx --clone yyy
  • 删除已有环境 conda remove -n xxx
  • 切换环境 conda activate xxx
  • 退出环境 conda deactivate

安装Tensorflow和Keras

$	conda install -n xxx tensorflow-gpu==1.14.0
$	conda install -n xxx keras==2.2.4
# 查看已安装的package
$	conda list

Warning解决

导入Tensorflow时抛出如下Warning:

/root/anaconda3/envs/py376tf114/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

原因是numpy版本太新,降版本可解决

$	pip uninstall numpy
$	pip install numpy=1.16.4

你可能感兴趣的:(环境配置,机器学习,机器学习,深度学习,tensorflow)