CentOS7服务器上部署深度/机器学习环境推荐首选anaconda3

CentOS7服务器上部署深度/机器学习环境推荐首选anaconda3,亲测~~ 因为可以创建不同的环境版本或虚拟环境

CentOS7服务器安装anaconda3后,CentOS7服务器开启后自动将anaconda3自身的root(或base)环境开启。

用Xshell打开CentOS7服务器后,可以看见 (base)

WARNING! The remote SSH server rejected X11 forwarding request.

Last login: Tue Mar 12 22:11:51 2019 from 192.168.1.72

(base) [jiangshan@localhost ~]$

查看环境,发现anaconda3自身的root(或base)环境处于活动状态 ============== 默认开机启动(在指定的用户下)

(base) [jiangshan@localhost ~]$ conda info -e

# conda environments:

#

base * /home/jiangshan/anaconda3

( * 代表活动状态)

===================试验=======================================================

(base) [jiangshan@localhost ~]$ source deactivate

DeprecationWarning: 'source deactivate' is deprecated. Use 'conda deactivate'.

[jiangshan@localhost ~]$

===================试验=======================================================

# TenssorFlow目前还不支持Python 3.7,使用Anaconda3创建Python 3.6虚拟环境

# 创建基于python 3.6 的tensorflow环境:

(base) [jiangshan@localhost ~]$ conda create --name tensorflow python=3.6

==========================================================================

## Package Plan ##

environment location: /home/jiangshan/anaconda3/envs/tensorflow

added / updated specs:

- python=3.6

==========================================================================

查看创建的tensorflow环境

(base) [jiangshan@localhost ~]$ conda info -e

# conda environments:

#

base * /home/jiangshan/anaconda3

tensorflow /home/jiangshan/anaconda3/envs/tensorflow

已经创建tensorflow环境,暂未进入激活

激活 tensorflow

(base) [jiangshan@localhost ~]$ source activate tensorflow

查看已激活的tensorflow环境

(tensorflow) [jiangshan@localhost ~]$ conda info -e

# conda environments:

#

base /home/jiangshan/anaconda3

tensorflow * /home/jiangshan/anaconda3/envs/tensorflow 【有 * 号】

在 tensorflow环境安装 tensorflow

(tensorflow) [jiangshan@localhost ~]$ conda install tensorflow

留意以下信息

==============================================================================================

## Package Plan ##

environment location: /home/jiangshan/anaconda3/envs/tensorflow

added / updated specs:

- tensorflow

The following NEW packages will be INSTALLED:

absl-py anaconda/cloud/conda-forge/linux-64::absl-py-0.7.0-py36_1000

astor anaconda/cloud/conda-forge/noarch::astor-0.7.1-py_0

blas anaconda/pkgs/free/linux-64::blas-1.0-mkl

c-ares anaconda/cloud/conda-forge/linux-64::c-ares-1.15.0-h14c3975_1001

gast anaconda/cloud/conda-forge/noarch::gast-0.2.2-py_0

grpcio pkgs/main/linux-64::grpcio-1.16.1-py36hf8bcb03_1

libgfortran-ng anaconda/cloud/conda-forge/linux-64::libgfortran-ng-7.2.0-hdf63c60_3

libprotobuf anaconda/cloud/conda-forge/linux-64::libprotobuf-3.7.0-hdbcaa40_1

markdown anaconda/cloud/conda-forge/noarch::markdown-2.6.11-py_0

mkl anaconda/pkgs/free/linux-64::mkl-2017.0.3-0

numpy pkgs/main/linux-64::numpy-1.14.2-py36hdbf6ddf_0

protobuf anaconda/cloud/conda-forge/linux-64::protobuf-3.7.0-py36hf484d3e_0

six anaconda/cloud/conda-forge/linux-64::six-1.12.0-py36_1000

tensorboard anaconda/cloud/conda-forge/linux-64::tensorboard-1.10.0-py36_0

tensorflow anaconda/cloud/conda-forge/linux-64::tensorflow-1.10.0-py36_0

termcolor anaconda/cloud/conda-forge/noarch::termcolor-1.1.0-py_2

werkzeug anaconda/cloud/conda-forge/noarch::werkzeug-0.14.1-py_0

==============================================================================================

# 查看虚拟环境已经安装的包

(tensorflow) [jiangshan@localhost ~]$ conda list

==============================================================================================

# packages in environment at /home/jiangshan/anaconda3/envs/tensorflow:

#

# Name Version Build Channel

absl-py 0.7.0 py36_1000 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

astor 0.7.1 py_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

blas 1.0 mkl https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free

c-ares 1.15.0 h14c3975_1001 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

ca-certificates 2019.3.9 hecc5488_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

certifi 2019.3.9 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

gast 0.2.2 py_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

grpcio 1.16.1 py36hf8bcb03_1 defaults

libffi 3.2.1 hf484d3e_1005 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

libgcc-ng 7.3.0 hdf63c60_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

libgfortran-ng 7.2.0 hdf63c60_3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

libprotobuf 3.7.0 hdbcaa40_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

libstdcxx-ng 7.3.0 hdf63c60_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

markdown 2.6.11 py_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

mkl 2017.0.3 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free

ncurses 6.1 hf484d3e_1002 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

numpy 1.14.2 py36hdbf6ddf_0 defaults

openssl 1.1.1b h14c3975_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

pip 19.0.3 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

protobuf 3.7.0 py36hf484d3e_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

python 3.6.7 h381d211_1004 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

readline 7.0 hf8c457e_1001 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

setuptools 40.8.0 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

six 1.12.0 py36_1000 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

sqlite 3.26.0 h67949de_1001 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

tensorboard 1.10.0 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

tensorflow 1.10.0 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

termcolor 1.1.0 py_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

tk 8.6.9 h84994c4_1000 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

werkzeug 0.14.1 py_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

wheel 0.33.1 py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

xz 5.2.4 h14c3975_1001 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

zlib 1.2.11 h14c3975_1004 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

==============================================================================================

# 测试

(tensorflow) [jiangshan@localhost ~]$ python

Python 3.6.7 | packaged by conda-forge | (default, Feb 28 2019, 09:07:38)

[GCC 7.3.0] on linux

Type "help", "copyright", "credits" or "license" for more information.

>>> import tensorflow as tf 【不报错就表示安装成功】

>>> quit()