tensorflow环境搭建centos环境

python安装方法

https://www.cnblogs.com/wintest/p/12057170.html

安装Anaconda3

参照博客:https://blog.csdn.net/shulixu/article/details/88553841

参照博客:https://www.jianshu.com/p/2831365a61c3

tensorflow环境搭建centos环境_第1张图片
anaconda版本 python版本对应关系
https://blog.csdn.net/yuejisuo1948/article/details/81043823

mac安装anaconda

https://www.pythonheidong.com/blog/article/483998/0c142aace6824d05b438/

在线安装命令(下载sh文件):
下载

wget https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh

执行sh文件:

bash Anaconda3-5.2.0-Linux-x86_64.sh
注意:有时候需要多次安装
bash Anaconda3-5.2.0-Linux-x86_64.sh -u

注意:安装过程为回车、yes
安装成功的最好文案为:thank you for installing anaconda3…

激活anaconda3的路径:

source ~/.bashrc

注意:~/.bashrc文件内容记录了anaconda3的安装路径,默认值为:/root/anaconda3

在Anaconda环境下搭建tensorflow

在这里插入图片描述

参照博客:https://blog.csdn.net/shulixu/article/details/88553841

1 建立一个名为tensorflow_env的运行环境,python=3.6

conda create --name tensorflow_env python=3.6
删除
conda remove --name tensorflow_env --all

2 激活tensorflow_env这个环境

conda activate tensorflow_env

激活 anaconda 环境

source activate

注意:先要激活tensorflow_env以后,再安装tensorflow

3 安装tensorflow

conda install tensorflow

注意:退出conda环境

conda deactivate

测试tensorflow是否安装成功

python

import tensorflow

注意:若不报错,则安装成功

登录tensorflow_env环境

登录tensorflow_env环境

source activate tensorflow_env

退出tensorflow_env环境

source deactivate

jupyter 安装

(tensorflow_env) [root@instance-02b383b1 ~]# jupyter notebook --generate-config
Writing default config to: /root/.jupyter/jupyter_notebook_config.py

tensorboard 安装

参照博客:https://blog.csdn.net/fendouaini/article/details/80344591

安装命令:

pip install tensorboard

注意:安装好了以后在路径:/root/anaconda3/bin 下面会有tensorbaord

tensorboard的使用

切换到目录

cd /root/anaconda3/bin
python tensorboard --logdir=/path/to/logs

系统会自动启动一个端口,输出日志为:

[root@VM_0_2_centos bin]# python tensorboard --logdir=/path/to/logs
TensorFlow installation not found - running with reduced feature set.
W0801 21:42:25.461625 140474065319680 plugin_event_accumulator.py:294] Found more than one graph event per run, or there was a metagraph containing a graph_def, as well as one or more graph events.  Overwriting the graph with the newest event.
W0801 21:42:25.461767 140474065319680 plugin_event_accumulator.py:302] Found more than one metagraph event per run. Overwriting the metagraph with the newest event.
TensorBoard 1.14.0 at http://VM_0_2_centos:6006/ (Press CTRL+C to quit)

打开浏览器输入ip和端口就可以访问了:

tensorflow环境搭建centos环境_第2张图片

错误问题解决

1、问题:No module named ‘PIL’
解决:链接:https://blog.csdn.net/m0_37422289/article/details/79284541

conda uninstall pillow

conda update pip

pip install pillow

2、问题: No module named ‘matplotlib’
解决:链接:https://blog.csdn.net/andyL_05/article/details/84994101

pip install -U matplotlib

3、问题: No module named ‘cv2’
解决:链接:https://blog.csdn.net/xnightmare/article/details/81416761

pip install opencv-python

4、问题:安装caffe
解决,链接:https://www.jianshu.com/p/cc16e2977e27
安装caffe的前置准备(OK):http://caffe.berkeleyvision.org/install_yum.html

两个环境都是
caffe 安装到cmake …报错了

5、问题:cmake安装
解决:https://blog.csdn.net/qq_38378235/article/details/80839693

6、问题:mac could not find Protobuf
解决:https://www.jianshu.com/p/f8b789280df4

7、问题:安装boost
解决:https://blog.csdn.net/xzwspy/article/details/81603227

你可能感兴趣的:(AI,tensorflow)