环境
- CentOS7
安装Conda
- 下载
Anaconda3-xxx-Linux-x86_64.sh
- 安装
$ sudo bash Anaconda3-xxx-Linux-x86_64.sh
- 使环境生效
$ 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