简体   繁体   English

安装 Tensorflow 的问题

[英]Issue with Installing Tensorflow

I have an issue with the installation of Tensorflow我在安装 Tensorflow 时遇到问题

I just completed installing Tensorflow with我刚刚完成安装 Tensorflow

$ pip install --user --upgrade tensorflow

and these are the last lines I get after this installation这些是我在安装后得到的最后几行

Successfully built absl-py gast
Installing collected packages: wheel, six, grpcio, absl-py, numpy, gast, astor, tensorflow, h5py, werkzeug, se                           tuptools
Successfully installed absl-py-0.7.1 astor-0.8.0 gast-0.2.2 grpcio-1.21.1 h5py-2.9.0 numpy-1.16.4 setuptools-4                           1.0.1 six-1.12.0 tensorflow-1.13.1 werkzeug-0.15.4 wheel-0.33.4  `````

and then when I enter the following command:然后当我输入以下命令时:

$ pip install --upgrade tensorflow

I do get a bunch of requirement already up-to-date as per the below .根据以下内容,我确实收到了一些requirement already up-to-daterequirement already up-to-date

Requirement already up-to-date: tensorflow in c:\users\xxx\appdata\roaming\python\python36\site-packages
Requirement already up-to-date: tensorflow-estimator<1.14.0rc0,>=1.13.0 in c:\programdata\anaconda3\lib\site-p                           ackages (from tensorflow)
Requirement already up-to-date: numpy>=1.13.3 in c:\users\xxx\appdata\roaming\python\python36\site-packag                           es (from tensorflow)
Requirement already up-to-date: gast>=0.2.0 in c:\users\xxx\appdata\roaming\python\python36\site-packages                            (from tensorflow)
Requirement already up-to-date: six>=1.10.0 in c:\users\xxx\appdata\roaming\python\python36\site-packages                            (from tensorflow)
Requirement already up-to-date: keras-preprocessing>=1.0.5 in c:\programdata\anaconda3\lib\site-packages (from                            tensorflow)
Requirement already up-to-date: tensorboard<1.14.0,>=1.13.0 in c:\programdata\anaconda3\lib\site-packages (fro                           m tensorflow)
Requirement already up-to-date: astor>=0.6.0 in c:\users\xxxx\appdata\roaming\python\python36\site-package                           s (from tensorflow)
Requirement already up-to-date: termcolor>=1.1.0 in c:\programdata\anaconda3\lib\site-packages (from tensorflo                           w)
Requirement already up-to-date: wheel>=0.26 in c:\users\xxxx\appdata\roaming\python\python36\site-packages                            (from tensorflow)
Requirement already up-to-date: keras-applications>=1.0.6 in c:\programdata\anaconda3\lib\site-packages (from                            tensorflow)
Requirement already up-to-date: grpcio>=1.8.6 in c:\users\xxxx\appdata\roaming\python\python36\site-packag                           es (from tensorflow)
Requirement already up-to-date: protobuf>=3.6.1 in c:\programdata\anaconda3\lib\site-packages (from tensorflow                           ) 

Which I interpret as everything is installed and upgraded ( am I wrong here ? )我将其解释为一切都已安装和升级(我在这里错了吗?)

Now my issue is that when I try to import Tensorflow let say in Jupyter notebook , I get the following error message现在我的问题是,当我尝试在 Jupyter notebook 中导入 Tensorflow 时,我收到以下错误消息

ImportError: Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "C:\ProgramData\Anaconda3\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "C:\ProgramData\Anaconda3\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

Any idea what could be the reason and what i need to change to get tensorflow up and running ?知道可能是什么原因以及我需要更改什么才能启动和运行 tensorflow 吗?

Thanks guys in advance for any help with the above issue .提前感谢大家对上述问题的任何帮助。

I've solved this problem by downgrading tensorflow to version 2.0 using this command:我通过使用以下命令将 tensorflow 降级到 2.0 版解决了这个问题:

pip install tensorflow==2.0点安装张量流==2.0

and then use like this :然后像这样使用:

from tensorflow.keras.applications import vgg19 from tensorflow.keras.models import load_model从 tensorflow.keras.applications 导入 vgg19 从 tensorflow.keras.models 导入 load_model

I hope it helps.我希望它有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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