Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/283.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python ModuleNotFoundError:Jupyter笔记本中没有名为“tensorflow”的模块_Python_Tensorflow_Anaconda - Fatal编程技术网

Python ModuleNotFoundError:Jupyter笔记本中没有名为“tensorflow”的模块

Python ModuleNotFoundError:Jupyter笔记本中没有名为“tensorflow”的模块,python,tensorflow,anaconda,Python,Tensorflow,Anaconda,我在Jupyter笔记本上发现了这个错误。完全错误如下所示: --------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) in 1 import numpy as np # working with data 2 import

我在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.  
巨蟒版本:

C:\Users\casper>conda --version
conda 4.5.4  
在Anaconda提示符中,我安装Tensorflow,如下所示:

conda create -n tensorflow python=3.6  
// CPU edition    
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow    
在Anaconda提示符中:我的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版本,现在对我来说真的是一团糟。我怎样才能修好它

尝试以管理员身份运行Anaconda右键单击->以管理员身份运行。 并尝试从Anaconda文档中获取以下命令:

conda create -n tf tensorflow
conda activate tf

您可能需要重新启动电脑。

请记住更换正确的内核。您可以在Jupyter笔记本中通过按下内核来实现这一点。然后选择Change kernel并选择您的内核。

您是否尝试过在Jupyter中打开一个新的终端,然后从那里执行pip冻结以进行检查。我以前遇到过一个问题,我需要在Jupyter终端中具体安装什么?你是否在Jupyter笔记本中选择了rigth内核?我犯了一个愚蠢的错误,我忘了更改内核。Thnx@Philip我怎么能接受这个答案?