Linux下安装tensorflow

墨蓝 2023-07-19 12:04 173阅读 0赞

环境准备

下载anaconda, https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh

安装

  1. [root@localhost ~]# wget https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh
  2. [root@localhost ~]# bash Anaconda3-2019.10-Linux-x86_64.sh

以上信息提示,都进行按ENTER,输入yes操作。

配置jupyter环境

  1. [root@localhost ~]# source /root/.bashrc

查看conda版本

  1. [root@localhost ~]# conda --version

配置jupyter notebook

  1. [root@localhost ~]# cd /root/anaconda3/etc/jupyter
  2. (base) [root@localhost jupyter]# jupyter notebook --generate-config

设置置jupyter notebook的登录密码

  1. (base) [root@localhost data]# python
  2. Python 3.7.4 (default, Aug 13 2019, 20:35:49)
  3. [GCC 7.3.0] :: Anaconda, Inc. on linux
  4. Type "help", "copyright", "credits" or "license" for more information.
  5. >>> from notebook.auth import passwd
  6. >>> passwd()
  7. Enter password:
  8. Verify password:
  9. 'sha1:fc48ba43d994:264211bcd15748509d8711bfede4ae330d208641'
  10. >>> exit()
  11. 'sha1:fc48ba43d994:264211bcd15748509d8711bfede4ae330d208641'密码后续需要。

修改jupyter notebook的文件设置

  1. (base) [root@localhost data]# cd /root/.jupyter/
  2. (base) [root@localhost .jupyter]# ls
  3. (base) [root@localhost .jupyter]# vim jupyter_notebook_config.py

修改登录配置

  1. c.NotebookApp.ip = 'ip' # 允许访问此服务器的 IP,星号表示任意 IP
  2. c.NotebookApp.password = u'sha1:fc48ba43d994:264211bcd15748509d8711bfede4ae330d208641' # 之前生成的密码字串
  3. c.NotebookApp.open_browser = False # 运行时不打开本机浏览器
  4. c.NotebookApp.port = 8888 # 使用的端口
  5. c.NotebookApp.enable_mathjax = True # 启用 MathJax
  6. c.NotebookApp.notebook_dir = '/root/jupyter' # 存放文件的目录
  7. c.NotebookApp.allow_remote_access = True # 允许远程访问

启动 jupyter notebook

  1. jupyter notebook --allow-root

开启linux防火墙,运行远程访问

查看防火墙状态

  1. (base) [root@localhost ~]#systemctl status firewalld.service #查看防火墙状态
  2. (base) [root@localhost ~]#systemctl stop firewalld.service #关闭运行的防火墙
  3. (base) [root@localhost ~]#systemctl status firewalld.service #查看防火墙状态可以看到

使用ip和设置的密码进行登录

jupyter安装tensorflow

登录jupyter后pip安装

  1. pip install keras tensorflow==2.0.0 -i https://pypi.tuna.tsinghua.edu.cn/simple/ --default-timeout=100

在这里插入图片描述

发表评论

表情:
评论列表 (有 0 条评论,173人围观)

还没有评论,来说两句吧...

相关阅读

    相关 ubantu安装TensorFlow

    今天初步接触TensorFlow这个用于人工智能的开源神器,同其它框架一样,配置过程不慎采坑,这里总结一下我搭建的全部过程,以便日后使用,同时希望能够对读者有所帮助。 首先