CentOS7人工智能工程师-环境配置-安装Python3.6+anaconda+pip+xgboost+Tensorflow

1.指定yum源并更新最新软件包

yum install -y https://centos7.iuscommunity.org/ius-release.rpm && yum update

2.安装python3.6

yum install -y python36u python36u-libs python36u-devel python36u-pip

或者

yum install -y python36u*

3.安装 anaconda

/*yum install -y  anaconda*/

(1).点击从官网下载 (anaconda)

  用命令下载:curl https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh >> Anaconda3-5.2.0-Linux-x86_64.sh

(2).安装 bash Anaconda3-5.0.1-Linux-x86_64.sh

(2).将路径添加到PATH中:export PATH=/root/anaconda3/bin:$PATH

(4).测试:conda --versio

4.安装tensorflow

(1).创建tensorflow运行环境:conda create -n tensorflow

(2).启动tensorflow运行环境:

source activate tensorflow

/*关闭运行环境:source deactivate tensorflow*/

(3).安装cpu版tensorflow

pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.3.0-cp36-cp36m-linux_x86_64.whl

CentOS7人工智能工程师-环境配置-安装Python3.6+anaconda+pip+xgboost+Tensorflow_第1张图片

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
conda install numpy
anaconda search -t conda tensorflow
anaconda show jjh_cio_testing/tensorflow
conda install --channel https://conda.anaconda.org/jjh_cio_testing tensorflow

5.安装pip

yum -y install python-pip

升级pip到最新版本

pip install --upgrade pip

CentOS7人工智能工程师-环境配置-安装Python3.6+anaconda+pip+xgboost+Tensorflow_第2张图片

 

6.通过pip安装xgboost

pip install xgboost

CentOS7人工智能工程师-环境配置-安装Python3.6+anaconda+pip+xgboost+Tensorflow_第3张图片

如果报安装超时错误则指定超时时间安装即可:

pip --default-timeout=100 install -U xgboost

7.测试tensorflow是否可用

#python

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()

print(sess.run(hello))

如果输出 hello 则安装成功!

CentOS7人工智能工程师-环境配置-安装Python3.6+anaconda+pip+xgboost+Tensorflow_第4张图片

8.注意,下次使用时先启动环境再进python

#source activate tensorflow

#python

 

值得参考的文章:https : // blog.csdn . net /qq_32435729/article/details/78622654

 

 

 

你可能感兴趣的:(Linux)