[英]Tensorflow translate.py import error: No module named translate
I'm trying to run Tensorflow's translate.py from a python console rather than through bazel -build, but I get an error at these two lines: 我试图从python控制台而不是通过bazel -build运行Tensorflow的translate.py,但是在这两行中出现错误:
from tensorflow.models.rnn.translate import data_utils
from tensorflow.models.rnn.translate import seq2seq_model
ImportError: No module named translate
I've checked the folder to see that the " init .py" file is there, but python seems to think there is no such module as translate. 我已经检查了文件夹,看到“ init .py”文件在那里,但是python似乎认为没有像translate这样的模块。 How can i fix this?
我怎样才能解决这个问题?
The best way to do this is to navigate to folder containing the translate module and running it. 执行此操作的最佳方法是导航到包含翻译模块并运行它的文件夹。 You can also download the translate module to any other place and run it.
您也可以将翻译模块下载到任何其他地方并运行它。 However, don't forget to change the above lines to:
但是,不要忘记将以上行更改为:
from translate import data_utils
from translate import seq2seq_model
I resolved this issue by removing all the from tensorflow.models.rnn.translate
statements, leaving just 我通过删除所有
from tensorflow.models.rnn.translate
语句解决了这个问题
import data_utils
import seq2seq_model
in translate.py
and 在
translate.py
和
import data_utils
in seq2seq_model.py
. 在
seq2seq_model.py
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.