安装Tensorflow的问题

时间:2019-06-19 12:36:04

标签: python tensorflow

我在安装Tensorflow时遇到问题

我刚刚使用

完成了Tensorflow的安装

$xml = simplexml_load_file('http://xml.propspace.com/feed/xml.php?cl=1327&pid=8782&acc=8781'); $result = file_get_contents('http://xml.propspace.com/feed/xml.php?cl=1327&pid=8782&acc=8781');

这些是我在安装之后的最后几行

$ pip install --user --upgrade tensorflow

然后输入以下命令:

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 `````

我确实收到了一大堆$ pip install --upgrade tensorflow,如下所示。

requirement already up-to-date

我解释为一切都已安装和升级(我在这里错了吗?)

现在我的问题是,当我尝试在Jupyter笔记本中导入Tensorflow时,我收到以下错误消息

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                           ) 

任何想法可能是什么原因,我需要进行更改以使tensorflow正常运行吗?

在此问题上,感谢大家。

1 个答案:

答案 0 :(得分:0)

我已经通过使用以下命令将tensorflow降级到2.0版来解决了这个问题:

pip install tensorflow == 2.0

然后像这样使用:

从tensorflow.keras.applications中的

导入vgg19 从tensorflow.keras.models导入load_model

我希望这会有所帮助。