【发布时间】:2021-11-03 05:40:21
【问题描述】:
我已经使用pip install keras 安装了 Keras,并通过python -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0-py2-none-any.whl 安装了 tensorflow 版本 1.9.0。我按照post 的指示,选择了一个似乎可以安装在我的电脑上的版本。我不确定是不是因为版本太旧了。我在 Windows 计算机上使用 Python 2。我正在运行以下导入语句并收到以下错误消息。
from keras.models import Sequential
from keras.layers import Dense
错误:
Traceback (most recent call last):
File "C:\Downloads\keras_code.py", line 2, in <module>
from keras.models import Sequential
File "C:\Python27\lib\site-packages\keras\__init__.py", line 21, in <module>
from tensorflow.python import tf2
File "C:\Python27\lib\site-packages\tensorflow\__init__.py", line 22, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Python27\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Python27\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Python27\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Python27\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Python27\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
import _pywrap_tensorflow_internal
ImportError: No module named _pywrap_tensorflow_internal
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
不可能立即获得一台新计算机,有没有办法让 keras/tensorflow 在旧计算机上工作?
【问题讨论】:
-
window python 2.7 不支持 TensorFlow stackoverflow.com/questions/45316569/…
标签: python windows tensorflow keras python-2.x