云服务器tensorflow GPU版本环境

更新:最后制作自定义镜像时发现一个非常不合理的现象。就是制作的镜像只会保存你安装的那些软件包,包括pandas/sklearn/matplotlib和jupyter notebook的配置。但是tensorflow/keras和原有的显卡驱动竟然没有保存到自定义镜像中!!!所以貌似只能每次购买实例时都重复以下步骤。。。

配置实例时从镜像市场选择预装tensorflow和显卡驱动的系统。

该系统预装了tensorflow 1.3.0以及对应显卡驱动、CUDA和cuDNN。购买配有GPU的实例后只需要配置jupyter notebook和其他软件包。

 

查看tensorflow版本

python
import tensorflow as tf
tf.__version__
tf.__path__

# python 2.7.5
# tensorflow 1.3.0

安装和配置远程访问jupyter notebook

# 安装jupyter notebook
python -m pip install jupyter
# 配置远程访问文件
jupyter notebook --generate-config --allow-root
# 会生成文件 /root/.jupyter/jupyter_notebook_config.py

# 设置jupyter密码
python
from notebook.auth import passwd
passwd()
'xxxxxxxxxxxxxxxxxxxxxxx密码串xxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
exit()
# 在远程访问配置文件加入
vim /root/.jupyter/jupyter_notebook_config.py
i
c.NotebookApp.ip = '*'
c.NotebookApp.password = 'xxxxxxxxxxxxxxxxxxxxxxxxxx密码串xxxxxxxxxxxxxxxxxxxxxxxxxx'
c.NotebookApp.port= 8888
c.NotebookApp.notebook_dir = "/root/"
c.NotebookApp.allow_remote_access = True
c.NotebookApp.open_browser = False
esc
:wq
# 远程访问
jupyter notebook --allow-root
# 浏览器输入服务器公共IP:8888访问
Ctrl+C

安装其他软件包

pip install pandas
pip install scikit-learn

# pip install matplotlib出错
yum install python-devel
pip install matplotlib

# 安装tensorflow版本对应的keras
pip install keras==2.0.6
# h5py用于保存模型
pip install h5py

测试是否安装成

 

以上。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

GottdesKrieges

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值