• 阿里云服务器端配置TensorFlow & jupyter


    在阿里云上搭建爬取某信的公众号文章的程序时,发现需要验证码验证,技穷之后考虑做一个验证码识别程序,所以开始在服务器上搭建机器学习平台,
    背景,服务器上已经有其他应用在跑着了,所以不想停服,
    初始环境:
    centos7
    gcc
    Python2.7

    目标环境:

    Python3.6

    TensorFlow 1.8

    (因为可能存在系统问题,所以建议先根据后面的排错查看gcc版本以及其他信息,)


    找了找其他人的经验,觉得可以参考这篇的方法,https://www.jianshu.com/p/98f8b55a4191


    1、Python3.6
    安装Python3.6,这个是之前装好的,没有用anaconda,就是原始安装的,
    2、TensorFlow
    按照教程的方法,pip安装TensorFlow 1.8之后测试时,发现报错:
    /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found
    Failed to load the native TensorFlow runtime。
    这里是gcc的问题了,开始找办法,
    首先排查一下这里(https://www.jianshu.com/p/4115338fba2d)提到的问题有没有出现,
    之后再看,一般出现这个问题时是系统安装了高版本gcc之后没有重新配置系统的超链接指向新的gcc程序,这个问题一查都是全系统搜索找到新的gcc的库位置,重建软连接就行了,一般都这样处理:https://blog.csdn.net/libaineu2004/article/details/77100132
    但是我这就特殊了,系统中没有更高版本了,find / -name libstdc++.so.6*之后最高就是3.4.19,没有20,那只好升级呗,
    结果:yum provides libstdc++.so.6
    之后,查到的跟人家的不一样:
    一般的,

    Loaded plugins: fastestmirror, langpacks
    Loading mirror speeds from cached hostfile
    * base: centos.ustc.edu.cn
    * extras: centos.ustc.edu.cn
    * updates: centos.ustc.edu.cn
    
    libstdc++-4.8.5-11.el7.i686 : GNU Standard C++ Library
    Repo        : base
    Matched from:
    Provides    : libstdc++.so.6

    我的:

    Loaded plugins: fastestmirror 
    Loading mirror speeds from cached hostfile
    * base: centos.ustc.edu.cn
    * extras: centos.ustc.edu.cn
    * updates: centos.ustc.edu.cn
    
    libstdc++-4.8.5-11.el7.i686 : GNU Standard C++ Library
    Repo        : base
    Matched from:
    Provides    : libstdc++.so.6
    
    libstdc++-4.8.5-28.el7_5.1.i686 : GNU Standard C++ Library 
    Repo : @update 
    Matched from:
    Provides    : libstdc++.so.6
    
    libstdc++-4.8.5-28.el7_5.1.i686 : GNU Standard C++ Library 
    Repo : @updates 
    Matched from:
    Provides    : libstdc++.so.6
    

    本来想找个什么办法直接升级到下一版本,但是没找到,怎么升级都报:
    Package libstdc++-4.8.5-28.el7_5.1.i686 already installed and latest version
    只好手动编译安装更高版本gcc,具体方法看这里:
    https://blog.csdn.net/leiting_imecas/article/details/60813164
    直接升级到libstdc++.so.6.0.21,升级完就好了,
    中途貌似会有个报错,

    make[3]: *** [build/genmddeps] Error 1
    make[3]: Leaving directory `/opt/mylinux/build/gcc-build/gcc'
    make[2]: *** [all-stage1-gcc] Error 2
    make[2]: Leaving directory `/opt/mylinux/build/gcc-build'
    make[1]: *** [stage1-bubble] Error 2
    make[1]: Leaving directory `/opt/mylinux/build/gcc-build'
    ...

    这时需要升级一下g++,https://www.cnblogs.com/Anker/p/3203402.html

    **编译过程非常耗时,我当时CPU100%跑了接近两小时,这样就会挤掉系统中正在跑的其他程序,如果你还部署了其他应用建议再检查下他们是否都还能正常服务,**
    之后再Python import tensorflow时就正常了,

    3、jupyter,具体方案在这里:https://blog.csdn.net/ys676623/article/details/77848427
    这个教程中修改完服务器端的jupyter的配置文件,配置文件中填写的密码应该是ipython给出的那个全部字符串,改完后是这样的:
    c.NotebookApp.password = u'sha1:XXXXXX'
    修改完服务器端的jupyter的配置文件后应该启动jupyter:
    jupyter notebook --ip=0.0.0.0 --no-browser --allow-root
    此时就已经可以正常在本地使用阿里云上的jupyter了,

    就这样了,有其他问题欢迎留言讨论,

    参考材料:https://www.cnblogs.com/faramita2016/p/7512471.html

  • 相关阅读:
    IO模型
    Redis的cluster模式
    #4789. 啊孤独感放辣椒
    #4754. 旅途
    #3189. 八纵八横(c)
    洛谷P2624 [HNOI2008]明明的烦恼
    CF938G Shortest Path Queries
    [CTSC2010]珠宝商
    洛谷P1903 [国家集训队]数颜色 / 维护队列
    AtCoder3611 Tree MST
  • 原文地址:https://www.cnblogs.com/1394htw/p/9866398.html
Copyright © 2020-2023  润新知