一、问题
今天在进行LSTM实验的时候,TensorFlow环境中未安装models就会报错,下图中reader下会飘红:
然后,寻找解决办法,发现之前安装TensorFlow的时候没有安装models的模块,所以这里进一步安装完善。
二、安装model
安装model的过程需要git tensorflow的官方源码(https://github.com/tensorflow/models)。具体操作方式为:
git clone --recurse-submodules https://github.com/tensorflow/models
或者到百度云盘进行下载:https://pan.baidu.com/s/1vs7fbN8j03ErV9s9AbMkag 密码:97os,然后将对应的文件放入\Anaconda3\Lib\site-packages\tensorflow\ 文件夹下面即可。
三、测试是否安装成功。我的测试中又报如下错误:
解决此问题,点进去_init_.py
将
import reader
import util
修改为:
from tensorflow.models.tutorials.rnn.ptb import reader
from tensorflow.models.tutorials.rnn.ptb import util
再次测试后成功运行。
参考文章:
https://blog.youkuaiyun.com/hh_2018/article/details/79779794
https://blog.youkuaiyun.com/ting_163/article/details/80597150
https://github.com/tensorflow/
https://blog.youkuaiyun.com/m0_37917271/article/details/82350571#commentBox