在AWS SageMaker上安装Keras和Tensorflow

时间:2019-07-06 19:44:22

标签: tensorflow keras amazon-sagemaker

我正在尝试将Keras下载到我的AWS SageMaker上的笔记本实例。代码和错误或警告如下所示:

from keras.models import Sequential #Sequential Models
from keras.layers import Dense #Dense Fully Connected Layer Type
from keras.optimizers import SGD #Stochastic Gradient Descent Optimizer
from keras.callbacks import EarlyStopping
from keras.wrappers.scikit_learn import KerasClassifier

错误:

ModuleNotFoundError: No module named 'tensorflow'

然后我尝试下载Tensorflow:

!pip install tensorflow

安装完成时需要注意以下几点:

Installing collected packages: wrapt, tensorflow
Found existing installation: wrapt 1.10.11
    Cannot uninstall 'wrapt'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
    You are using pip version 10.0.1, however version 19.1.1 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.

然后我尝试卸载wrapt,但仍然遇到相同的问题。有人遇到过同样的问题吗?这是SageMaker的相关问题吗?我还尝试运行以下行,但没有更改:

from sagemaker.tensorflow import TensorFlow

1 个答案:

答案 0 :(得分:1)

尝试一下:

!pip install tensorflow -t ./

它将在您的当前目录中安装tensorflow