ubuntu16.04 keras程序运行报错和解决

来源:互联网 发布:软件的特性 编辑:程序博客网 时间:2024/06/09 22:11

为了实现神经网络的Dropout随机失活,在网上搜了神经网络的Dropout正则化,它使用keras实现,我的tensorflow环境没有keras,因此安装:

在ubuntu终端输入source activate tensorflow,激活tensorflow环境,然后使用pip install keras安装,安装成功之后在pycharm import keras不报错;

实现链接中的代码并运行:

报错:
tensorflow.python.framework.errors_impl.NotFoundError: /home/rh/Applications/Anaconda/anaconda3/lib/python3.5/site-packages/tensorflow/contrib/cudnn_rnn/python/ops/_cudnn_rnn_ops.so: cannot open shared object file: No such file or directory
解决方式:

Which tensorflow pip package did you install? -- I just realized you installed through conda. The packages in conda are community maintained, so I am not sure what might be wrong there. Is it possible for you to try a pip install, maybe in a clean conda environment? the command should be :pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorfl‌​ow-0.12.1-cp35-cp35m‌​-linux_x86_64.whl(在tensorflow1环境下)

但是运行到一半在终端报错了,没管,再一次用pycharm运行程序

报错:setuptools-27.2.0-py3.5.egg

解决方式:

1. 下载ez_setup.py。Linux下可使用此命令: wget -q http://peak.telecommunity.com/dist/ez_setup.py。

2. 运行ez_setup.py:python ez_setup.py  ;如果运行正常,那就安装成功了。(在tensorflow1环境下)

但是终端还是报错,没管,再一次运行pycharm

报错:keras sigmoid_cross_entropy_with_logits() got an unexpected keyword argument 'labels'

解决方式:

基于Tensorflow的keras运行错误解决方案

终端运行没有报错,运行pycharm,成功





原创粉丝点击