简体   繁体   English

导入 tensorflow.keras 时出现 modulenotfound 错误

[英]Getting modulenotfound error when importing tensorflow.keras

I am following neural nine's tutorial on how to build a chatbot (witch can be found here ) and i had some issues installing tensorflow, but i finally did it, by first installing tensorflow-gpu , and then installing tensorflow.我正在关注神经九关于如何构建聊天机器人的教程(可以在这里找到女巫),我在安装 tensorflow 时遇到了一些问题,但我终于做到了,首先安装tensorflow-gpu ,然后安装 tensorflow。

When i ran the program with these tensorflow imports:当我使用这些 tensorflow 导入运行程序时:

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Activation, Dropout
from tensorflow.keras.optimizers import SGD

I get我明白了

Traceback (most recent call last):
  File "c:/Users/User/Documents/Python Projects/chatbot/traning.py", line 9, in <module>
    import tensorflow.keras
  File "C:\Users\User\AppData\Roaming\Python\Python38\site-packages\tensorflow\__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "C:\Users\User\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\__init__.py", line 40, in <module>
    from tensorflow.python.eager import context
  File "C:\Users\User\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\eager\context.py", line 29, in <module>
    from absl import logging
ModuleNotFoundError: No module named 'absl'

I tried reinstalling abseil, but that didn't work.我尝试重新安装abseil,但没有奏效。 Then i checked online and most of the answers are suggesting that the person has installed abseil on python 2.x and that they just have to use pip3 .然后我在网上查了一下,大多数答案都表明这个人已经在 python 2.x 上安装了 abseil 并且他们只需要使用pip3 I do not have python 2, so that is not possible.我没有 python 2,所以这是不可能的。 The question that is similar can be found here可以找到类似的问题here

Intel's Graphics Cards are not officially supported by tensorflow-gpu (Please refer to this post ). tensorflow-gpu不正式支持英特尔的显卡(请参阅这篇文章)。

I found, however, a project pointed out here suggesting this OpenCL Solution where it is allegedly possible to use an Intel GPU ( issue where compatibility is refereed )但是,我发现这里指出的一个项目建议使用这个OpenCL 解决方案,据称可以使用英特尔 GPU(兼容性问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM