使用 python 3.7.7 安装 tensorflow 1.15 的问题
Posted
技术标签:
【中文标题】使用 python 3.7.7 安装 tensorflow 1.15 的问题【英文标题】:Issue of installing tensorflow 1.15 with python 3.7.7 【发布时间】:2021-07-27 17:26:09 【问题描述】:我正在尝试安装 tensorflow 1.15,它安装得很好。当我再次运行pip install tensorflow==1.15
时,它会显示以下屏幕:
C:\Users\Fatima>pip install tensorflow==1.15
Requirement already satisfied: tensorflow==1.15 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (1.15.0)
Requirement already satisfied: tensorflow-estimator==1.15.1 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.15.1)
Requirement already satisfied: keras-applications>=1.0.8 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.0.8)
Requirement already satisfied: grpcio>=1.8.6 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.37.1)
Requirement already satisfied: termcolor>=1.1.0 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.1.0)
Requirement already satisfied: six>=1.10.0 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.15.0)
Requirement already satisfied: keras-preprocessing>=1.0.5 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.1.2)
Requirement already satisfied: gast==0.2.2 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (0.2.2)
Requirement already satisfied: absl-py>=0.7.0 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (0.12.0)
Requirement already satisfied: opt-einsum>=2.3.2 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (3.3.0)
Requirement already satisfied: wrapt>=1.11.1 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.12.1)
Requirement already satisfied: numpy<2.0,>=1.16.0 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.20.2)
Requirement already satisfied: protobuf>=3.6.1 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (3.15.8)
Requirement already satisfied: astor>=0.6.0 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (0.8.1)
Requirement already satisfied: wheel>=0.26 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (0.36.2)
Requirement already satisfied: tensorboard<1.16.0,>=1.15.0 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.15.0)
Requirement already satisfied: google-pasta>=0.1.6 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (0.2.0)
Requirement already satisfied: h5py in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from keras-applications>=1.0.8->tensorflow==1.15) (3.2.1)
Requirement already satisfied: markdown>=2.6.8 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorboard<1.16.0,>=1.15.0->tensorflow==1.15) (3.3.4)
Requirement already satisfied: setuptools>=41.0.0 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorboard<1.16.0,>=1.15.0->tensorflow==1.15) (41.2.0)
Requirement already satisfied: werkzeug>=0.11.15 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorboard<1.16.0,>=1.15.0->tensorflow==1.15) (1.0.1)
Requirement already satisfied: importlib-metadata in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from markdown>=2.6.8->tensorboard<1.16.0,>=1.15.0->tensorflow==1.15) (4.0.1)
Requirement already satisfied: cached-property in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from h5py->keras-applications>=1.0.8->tensorflow==1.15) (1.5.2)
Requirement already satisfied: typing-extensions>=3.6.4 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from importlib-metadata->markdown>=2.6.8->tensorboard<1.16.0,>=1.15.0->tensorflow==1.15) (3.10.0.0)
Requirement already satisfied: zipp>=0.5 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from importlib-metadata->markdown>=2.6.8->tensorboard<1.16.0,>=1.15.0->tensorflow==1.15) (3.4.1)
这意味着安装了tensorflow,对吗?我使用的python是V3.7.7
我使用 Pycharm 运行以下代码作为测试:
import tensorflow as tf
print(tf.__version__)
它给我一个错误如下:
Traceback (most recent call last):
File "C:/Python394/for_trials.py", line 1, in <module>
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'
好像是无法识别tensorflow,或者python与Tf1不兼容。但是,按照指南,python 3.7 及更早版本与 Tf1 兼容。
您能帮我解决安装 Tf1 的问题吗?
谢谢
【问题讨论】:
【参考方案1】:问题是你的机器上已经很好地安装了tensorflow,但是在哪个环境下呢?为了让 pycharm 看到 tensorflow,tensorflow 必须安装在 pycharm 用来执行代码的相同环境中。但是,例如,如果您的 pycharm 配置为在虚拟环境中执行代码,并且 tensorflow 安装在 anaconda 中,则它无法正常工作。所以可以做的简单的解决办法就是把pycham的环境改成安装tensorflow的环境
【讨论】:
是的,我注意到安装的Anacoona是python V3.8,但是我在哪里可以得到python 3.7的anaconda。我无法上网。当我单击此处下载时,anaconda.com/products/individual 我只得到适用于 python 3.8 的 Anaconda 为什么要在 python 3.7 中使用 anaconda? 3.8版不错。您安装 3.8 版并在 pycharm 中更改解释器版本,如下所示:为什么要将 anaconda 用于 python 3.7? 3.8版不错。您安装 3.8 版并在 pycharm 中更改解释器的版本,如下所示:(我无法在答案中添加屏幕截图,因此我将其放在另一个答案中) 是的,但是当我从 anaconda 安装 tensorflow 1.15 时,它会拒绝。它给出了一个错误,即 tensorflow 的版本必须是 2.2 及更高版本。为此,我正在寻找适用于 python 3.7 的 anaconda dans ce cas tu retrograde simplement la version de python comme : conda install python 3.7 oui, c March bien mtn ... j'ai installe le anaconda pr python 3.7, et mtn tt va b1【参考方案2】:tu change l'interpréteur comme ceci
你改变 l'interpréteur comme ceci tu change l'interpréteur comme ceci
【讨论】:
以上是关于使用 python 3.7.7 安装 tensorflow 1.15 的问题的主要内容,如果未能解决你的问题,请参考以下文章
python中将一个任意长度,元素皆为整数的list,任意个相邻的数可以组成新的list,求新list元素和最大值?
新手学Python之学习官网教程(四: More Control Flow Tools)
ubuntu 中用pip安装了theano后怎么找不到theano,tensor,signal,downsample