jupyter tensorflow配置

jupyter tensorflow配置

Anaconda安装

  • 按照官网安装即可

tensorflow

  • 按照官网安装即可
  • 使用时需要source activate tensorflow

windows防火墙配置

  • 在配置jupyter,使其能够远程访问之前,首先需要配置本地的防火墙,因为用服务器ping本地windows机器出现了无法连接的情况
  • 解决办法的链接:http://blog.51cto.com/digup/1568218。大概就是新建一个规则,使其能够被ping

jupyter配置

  • 因为新建的虚拟环境中可能没有jupyter、ipython等库,因此需要重新安装它们。配置的参考链接:https://www.jianshu.com/p/444c3ae23035
  • 实际配置的过程中,ip设置为本地的ip时,无法启动,因此设置为’*’,使得所有的内网都可以连接

本地找不到kernel的问题

最终的使用步骤

  • 激活tf环境:source activate tensorflow
  • 启动notebook:jupyter notebook
  • 在本地登录服务器的地址以及对应端口即可
  • 关闭tf环境:source deactivate tensorflow
# 测试代码
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf

# 不显示python使用过程中的警告
import warnings
warnings.filterwarnings("ignore")
a = tf.constant( np.ones((3,2)) )
b = tf.constant( np.ones((2,3)) )
sess = tf.Session()
c = sess.run( tf.matmul(a,b) )
print(c)
plt.plot( np.random.rand(20,1) )
plt.show()
[[2. 2. 2.]
 [2. 2. 2.]
 [2. 2. 2.]]

这里写图片描述

猜你喜欢

转载自blog.csdn.net/u012526003/article/details/79117593