<p><strong>问题:</strong></p>
<p>我正确安装了<code>keras</code>和<code>tensorflow</code>。虽然它们都已安装,但在<code>import keras</code>时遇到以下错误:</p>
<pre><code> File "/root/PycharmProjects/DeepLearning/paper/test.py", line 1, in <module>
import keras.activations
File "/home/saeed/.conda/envs/py35/lib/python3.5/site-packages/keras/__init__.py", line 3, in <module>
from . import utils
File "/home/saeed/.conda/envs/py35/lib/python3.5/site-packages/keras/utils/__init__.py", line 6, in <module>
from . import conv_utils
File "/home/saeed/.conda/envs/py35/lib/python3.5/site-packages/keras/utils/conv_utils.py", line 9, in <module>
from .. import backend as K
File "/home/saeed/.conda/envs/py35/lib/python3.5/site-packages/keras/backend/__init__.py", line 89, in <module>
from .tensorflow_backend import *
File "/home/saeed/.conda/envs/py35/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 6, in <module>
from tensorflow.python.framework import ops as tf_ops
ImportError: No module named 'tensorflow.python'; 'tensorflow' is not a package
</code></pre>
<p><strong>我的努力:</strong></p>
<p>我尝试了这些解决方案<a href="https://stackoverflow.com/questions/46568913/tensorflow-import-error-no-module-named-tensorflow">1</a>,<a href="https://stackoverflow.com/questions/42244198/importerror-no-module-named-tensorflow">2</a>,<a href="https://stackoverflow.com/questions/41415629/importerror-no-module-named-tensorflow-python">3</a>,但没有找到结果。同时卸载<code>keras</code>和<code>tensorflow</code>并重新安装,但没有用。你知道吗</p>
<p>问题出在哪里?你知道吗</p>
<blockquote>
<p><strong>System</strong>: Ubuntu 18.04.1 LTS</p>
<p><strong>Python</strong>: 3.5</p>
<p><strong>Keras</strong>: 2.2.2</p>
<p><strong>Tensorflow</strong>: 1.10.0</p>
</blockquote>