一、安装所需软件
1.1 Anaconda
链接: link
进入到指定目录
sh Anaconda3-2020.11-Linux-x86_64.sh
按照指示输入enter或者yes
添加环境变量vi /etc/profile
conda list如果能使用则安装成功
1.2 Tensorflow2
配置jupyter环境
[root@localhost ~]# source /root/.bashrc
配置jupyter notebook
[root@localhost ~]# cd /root/anaconda3/etc/jupyter
(base) [root@localhost jupyter]# jupyter notebook --generate-config
设置jupyter notebook的登录密码
(base) [root@izwz9inovbad1itlt8v4taz ~]# cd /root/anaconda3/etc/jupyter
(base) [root@izwz9inovbad1itlt8v4taz jupyter]# jupyter notebook --generate-config
Writing default config to: /root/.jupyter/jupyter_notebook_config.py
(base) [root@izwz9inovbad1itlt8v4taz jupyter]# python
Python 3.8.5 (default, Sep 4 2020, 07:30:14)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from notebook.auth import passwd
>>> passwd()
Enter password:
Verify password:
'argon2:$argon2id$v=19$m=10240,t=10,p=8$okO0TZ2FHS7ZXWPXix/XXg$4Gga3sdhjE1si+bbXB9utQ'
修改jupyter notebook的文件设置
(base) [root@localhost data]# cd /root/.jupyter/
(base) [root@localhost .jupyter]# ls
(base) [root@localhost .jupyter]# vim jupyter_notebook_config.py
c.NotebookApp.ip = 'ip' # 允许访问此服务器的 IP,星号表示任意 IP
c.NotebookApp.password = u'sha1:fc48ba43d994:264211bcd15748509d8711bfede4ae330d208641' # 之前生成的密码字串
c.NotebookApp.open_browser = False # 运行时不打开本机浏览器
c.NotebookApp.port = 8888 # 使用的端口
c.NotebookApp.enable_mathjax = True # 启用 MathJax
c.NotebookApp.notebook_dir = '/root/jupyter' # 存放文件的目录
c.NotebookApp.allow_remote_access = True # 允许远程访问
启动 jupyter notebook
jupyter notebook --ip=0.0.0.0 --allow-root
安装
pip install keras tensorflow==2.3.0 -i https://pypi.tuna.tsinghua.edu.cn/simple/ --default-timeout=100 --use-feature=2020-resolver
把对应的脚本放到jupyter上看是否能够运行,通常如果文件路径设置正确的话,执行就已经成功了