1. Centos7上安装TensorFlow
sudo yum -y install epel-release sudo yum -y install gcc gcc-c++ python-pip python-devel atlas atlas-devel gcc-gfortran openssl-devel libffi-devel # use pip or pip3 as you prefer for python or python3 pip install --upgrade virtualenv virtualenv --system-site-packages ~/venvs/tensorflow source ~/venvs/tensorflow/bin/activate pip install --upgrade numpy scipy wheel cryptography #optional # ref https://www.tensorflow.org/install/install_linux#the_url_of_the_tensorflow_python_package pip install --upgrade https://download.tensorflow.google.cn/linux/cpu/tensorflow-1.8.0-cp27-none-linux_x86_64.whl # or below if you want gpu, support, but cuda and cudnn are required, see docs for more install instructions #pip install --upgrade https://download.tensorflow.google.cn/linux/gpu/tensorflow_gpu-1.8.0-cp27-none-linux_x86_64.whl
2. Jupyter notebook的安装
pip install jupyter pip install ipykernel python -m ipykernel install --user --name tensorflow --display-name "py27(tensorflow)"
jupyter notebook默认不支持远程访问。配置远程访问的方法如下:
1.生成配置文件:jupyter notebook –generate-config
2.生成密码:进入python终端
>>>from Ipython.lib import passwd >>>passwd() Enterpassword: Verify password: 'sha1:1d68765c0816:e4688c38af42ecb3b42c075543ffdf2ca4c7d248'
3.修改配置文件
/home/用户名/.jupyter/jupyter_notebook_config.py
c.NotebookApp.ip='0.0.0.0' c.NotebookApp.password = u'sha:ce...刚才复制的那个密文' c.NotebookApp.open_browser = False c.NotebookApp.port =8888 #随便指定一个端口
注意:
网上有很多教程把ip设置为 c.NotebookApp.ip=’*’
这样会报错 socket.gaierror: [Errno -2] Name or service not known
4. 启动jupyter。
jupyter notebook
3. 常见错误处理
1. error: open of epel-release failed: No such file or directory
安装:sudo rpm -vih http://mirrors.aliyun.com/epel//epel-release-latest-7.noarch.rpm
提示如下:
Retrieving http://mirrors.aliyun.com/epel//epel-release-latest-7.noarch.rpm warning: /var/tmp/rpm-tmp.uldNEC: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY warning: Unable to get systemd shutdown inhibition lock: Unit is masked. Preparing... ################################# [100%] file /etc/yum.repos.d/epel-testing.repo from install of epel-release-7-11.noarch conflicts with file from package epel-release-7-9.noarch file /etc/yum.repos.d/epel.repo from install of epel-release-7-11.noarch conflicts with file from package epel-release-7-9.noarch
更新源:yum clean all && yum makecache