gpt4 book ai didi

python - ModuleNotFoundError : No module named 'tensorflow' In Jupyter Notebook

转载 作者:行者123 更新时间:2023-12-04 10:35:00 25 4
gpt4 key购买 nike

我收到这个 错误 在我的 Jupyter 笔记本中。完整的错误如下:

---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
in
1 import numpy as np # working with data
2 import pandas as pd
----> 3 from keras.layers.core import Dense, Activation, Dropout
4 from keras.layers.recurrent import LSTM
5 from keras.models import Sequential

~\AppData\Local\Programs\Python\Python37-32\lib\site-packages\keras\__init__.py in
1 from __future__ import absolute_import
2
----> 3 from . import utils
4 from . import activations
5 from . import applications

~\AppData\Local\Programs\Python\Python37-32\lib\site-packages\keras\utils\__init__.py in
4 from . import data_utils
5 from . import io_utils
----> 6 from . import conv_utils
7 from . import losses_utils
8 from . import metrics_utils

~\AppData\Local\Programs\Python\Python37-32\lib\site-packages\keras\utils\conv_utils.py in
7 from six.moves import range
8 import numpy as np
----> 9 from .. import backend as K
10
11

~\AppData\Local\Programs\Python\Python37-32\lib\site-packages\keras\backend\__init__.py in
----> 1 from .load_backend import epsilon
2 from .load_backend import set_epsilon
3 from .load_backend import floatx
4 from .load_backend import set_floatx
5 from .load_backend import cast_to_floatx

~\AppData\Local\Programs\Python\Python37-32\lib\site-packages\keras\backend\load_backend.py in
88 elif _BACKEND == 'tensorflow':
89 sys.stderr.write('Using TensorFlow backend.\n')
---> 90 from .tensorflow_backend import *
91 else:
92 # Try and load external backend.

~\AppData\Local\Programs\Python\Python37-32\lib\site-packages\keras\backend\tensorflow_backend.py in
3 from __future__ import print_function
4
----> 5 import tensorflow as tf
6 from tensorflow.python.eager import context
7 from tensorflow.python.framework import device as tfdev

ModuleNotFoundError: No module named 'tensorflow'

cmd:我的python版本是:
C:\Users\casper>python --version
Python 3.6.5 :: Anaconda, Inc.

python 版本:
C:\Users\casper>conda --version
conda 4.5.4

python 提示我像下面这样安装 Tensorflow:
conda create -n tensorflow python=3.6  
// CPU edition
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow

python 提示 :我的 Tensorflow 版本是:
(base) C:\Users\casper>activate tensorflow

(tensorflow) C:\Users\casper>python
Python 3.6.2 |Continuum Analytics, Inc.| (default, Jul 20 2017, 12:30:02) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
2020-02-14 19:36:32.468120: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-02-14 19:36:32.474896: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
>>> tf.__version__
'2.1.0'
>>> tf.__path__
['D:\\Anaconda3\\envs\\tensorflow\\lib\\site-packages\\tensorflow']

这真的是我第一次使用所有这些库和技术,我迷失了方向,我可以看到所有不同的 Python 版本,现在对我来说真的一团糟。我怎么能修好呢?

最佳答案

请记住更改为正确的内核。您可以在 Jupyter Notebook 中按 Kernel 执行此操作。 .然后选择Change kernel并选择您的内核。

关于python - ModuleNotFoundError : No module named 'tensorflow' In Jupyter Notebook,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60225954/

25 4 0