简体   繁体   中英

Tensorflow - The kernel appears to have died. It will restart automatically

I am reading "Hands-On Machine Learning with Scikit-Learn, Keras and Tensorflow" and installed Tensorflow 2 as follows:

$ python3 -m pip install --upgrade tensorflow

In the jupyter notebook I tried to import Tensorflow as follows:

import tensorflow as tf

But then I get the following error message:

The kernel appears to have died. It will restart automatically

I know there is a bunch of StackOverflow threads about this topic. I have read them all. Some of them are old, some are new. Most of them suggest to downgrade the Tensorflow version to 1.5. But when I do that I can not use some of the methods of the Keras API (eg load_data() could not be found).

Is there anyone who have found a solution for that?

The second version of the textbook is all about TensorFlow version 2 so you have to use TensorFlow version 2 to use code. if there is a problem get the first version of the textbook which uses TensorFlow 1.

But I suggest learning TensorFlow 2 as it is the latest version.
if you are using anaconda Try installing TensorFlow 2 in a new environment.
To create a new environment open anaconda prompt.

conda create -n envname python=3.6

and then activate the environment

activate envname

Now try installing TensorFlow 2 and other necessary modules and check.

If it does not work the best solution is to use google colab(colab.research.google.com/).where you can do everything online, you can even have free GPU.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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