Yaocylulu

导航

linux下anaconda和keras配置过程

连接服务器,使用ssh协议。

下载anaconda

bash Anaconda3-5.1.0-Linux-x86_64.sh(安装过程需要输入yes来添加环境变量,需要输入一次安装路径。)

因为环境变量的改变,所以安装完成后需要关闭重新连接服务器。

建环境容器

conda create -n tensorflow python=3.6

激活容器

source activate tensorflow

清华源:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

conda config --set show_channel_urls yes

安装TensorFlow-gpu

anaconda search -t conda tensorflow 查看TensorFlow版本

pip install tensorflow-gpu==1.4.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

安装keras

conda install keras

安装notebook

conda install jupyter

生成notebook配置文件

jupyter notebook --generate-config --allow-root 

进入python,然后输入:

In [1]: from notebook.auth import passwd

In [2]: passwd()

接下来输入密码和确认密码

Enter password:

Verify password:

python将输出类似以下的一串字符,将其保存。

Out[2]: 'sha1:11d12d064a2e:a8fd0c3357e6a0961b1d8405841bac2909d24933'

exit() 退出python编译环境

生成两个证书

openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mykey.key -out mycert.pem 

配置notebook

vim /root/.jupyter/jupyter_notebook_config.py  编辑这个配置文件,把以下几行复制到配置文件

c.NotebookApp.certfile = u'/root/mycert.pem'

c.NotebookApp.keyfile = u'/root/mykey.key'

c.NotebookApp.ip = '*'

c.NotebookApp.password = u'sha1:11d12d064a2e:a8fd0c3357e6a0961b1d8405841bac2909d24933'  #(刚刚python的输出字符)

c.NotebookApp.open_browser = False

c.NotebookApp.port = 41581  #(端口号)

激活notebook

jupyter notebook --allow-root

posted on 2018-12-03 19:51  Yaocylulu  阅读(310)  评论(0编辑  收藏  举报