pip升级
pip3 install --upgrade pip 四、python机器学习和深度学习库安装 1.安装机器学习相关库 pip3 install -U wheel pip3 install -U numpy pip3 install -U scipy pip3 install -U matplotlib pip3 install -U pandas pip3 install -U scikit-learn pip3 install -U ipython jupyter notebook pip3 install -U spyder pip3 install -U dill 2.安装深度学习相关库 yum install -y python-numpy python-dev cmake zlib1g-dev libjpeg-dev xvfb libav-tools xorg-dev python-opengl libboost-all-dev libsdl2-dev swig pip3 install -U h5py pip3 install -U tensorflow-gpu pip3 install -U scikit-image pip3 install -U keras pip3 install -U keras-rl # 强化学习(可选) pip3 install -U keras-vis # 可视化(可选) pip3 install -U gym[all] (可选,安装时稍微有些麻烦,暂时没用到,未安装) 五、jupyter配置 1.生成默认配置 # cd /usr/local/python3/bin # ./jupyter notebook --generate-config Writing default config to: /home/user/.jupyter/jupyter_notebook_config.py 2.编辑配置文件 # vim /home/user/.jupyter/jupyter_notebook_config.py c.NotebookApp.ip = '*' #所有绑定服务器的IP都能访问 c.NotebookApp.port = 8899 #将端口设置为自己喜欢的吧,默认是8888 c.NotebookApp.open_browser = False #我们并不想在服务器上直接打开Jupyter Notebook,所以设置成False c.NotebookApp.notebook_dir = '/data/bigdata/notebooks/' #设置notebook工作目录 3. 设置Jupyter Notebook密码在python控制台 ,输入
In [1]: from notebook.auth import passwd In [2]: passwd() Enter password: ******* Verify password:******* Out[2]: 'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed' #密码密文修改配置密码信息
# vim /home/you/.jupyter/jupyter_notebook_config.py c.NotebookApp.password = u'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed' #注意前面的u 4.启动设置为开机自启动服务
# cd ~ # mkdir services # vim jupyter.service在 jupyter.service 中输入
[Unit] Description=Jupyter notebook env [Service] User=root Group=root Environment=LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64 #添加此环境变量,避免启动tensorFlow时找不到某些类库 ExecStart=/usr/local/python3/bin/jupyter notebook --allow-root [Install] WantedBy=multi-user.target保存退出
# cp ./jupyter.service /usr/lib/systemd/system/jupyter.service # ln -s /usr/lib/systemd/system/jupyter.service jupyter.service #同时修改此两个文件开机自启动
# systemctl enable jupyter.service启动服务
# systemctl start jupyter.servicePS:单独启动一次可通过如下方式(必须在用户目录下, 如/root目录下执行)
nohup /usr/local/python3/bin/jupyter notebook --allow-root >/dev/null 2>&1 & 六、测试下环境至此,深度学习所用到的环境搭建完成,下面我们就拿训练人脸识别的模型做个测试吧。
bingo,这一天的工作,值了。
问题 1.运行 init 3 报错注意: 如果报如下错误,可能是因为/boot下空间不足了
[root@localhost GPU]# init 3 Broadcast message from systemd-journald@localhost.localdomain (Wed 2017-09-20 11:26:40 CST): dracut[11820]: dracut: creation of /boot/initramfs-3.10.0-693.2.2.el7.x86_64kdump.img failed Message from syslogd@localhost at Sep 20 11:26:40 ... dracut:dracut: creation of /boot/initramfs-3.10.0-693.2.2.el7.x86_64kdump.img failed查看/boot 空间
[root@localhost boot]# df /boot 文件系统 1K-块 已用 可用 已用% 挂载点 /dev/sdb1 255724 253488 2236 100% /boot查看老版本的内核版本
[root@localhost boot]# rpm -qa|grep kernel kernel-3.10.0-514.26.2.el7.x86_64 kernel-tools-libs-3.10.0-693.2.2.el7.x86_64 kernel-headers-3.10.0-693.2.2.el7.x86_64 kernel-tools-3.10.0-693.2.2.el7.x86_64 kernel-devel-3.10.0-693.2.2.el7.x86_64 kernel-3.10.0-693.2.2.el7.x86_64 kernel-3.10.0-514.el7.x86_64 abrt-addon-kerneloops-2.1.11-48.el7.centos.x86_64卸载老版本内核
[root@localhost boot]# rpm -e kernel-3.10.0-514.el7.x86_64 kernel-3.10.0-514.26.2.el7.x86_64