python-2.7 - 在 python 2.7 上安装 tensorflow
问题描述
我想在 python 2.7 上安装 tensorflow 我在 conda(windows 10)上为 python 2.7 构建了环境。但是当我尝试通过“conda install tensorflow”安装 tensorflow 时,我得到了一个错误消息,如下所示。
===========================================================================
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: /
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.-
failed
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
Specifications:
- tensorflow -> python[version='3.5.*|3.6.*|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|3.7.*|3.8.*|3.9.*']
Your python: python=2.7
If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.
===========================================================
当我将 pip 与 [pip install tensorflow] 一起使用时,我得到了按摩
========================
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow
========================
我已经知道当前的 tensorflow 不支持 python 2.7,但我仍然需要 tensorflow 在 python 2.7 上工作
我应该怎么做才能在 conda 环境中为 python 2.7 安装 tensorflow?tensorflow 版本是否为 1.0.0 或更高版本并不重要。
解决方案
Tensorflow最新版本不支持Python2.7
系统要求
- Python 3.6–3.9 Python 3.9 支持需要 TensorFlow 2.5 或更高版本。Python 3.8 支持需要 TensorFlow 2.2 或更高版本。
- pip 19.0 或更高版本(需要 manylinux2010 支持)
- Ubuntu 16.04 或更高版本(64 位)
- macOS 10.12.6 (Sierra) 或更高版本(64 位)(不支持 GPU)
- macOS 需要 pip 20.3 或更高版本
- Windows 7 或更高版本(64 位)
- 适用于 Visual Studio 2015、2017 和 2019 的 Microsoft Visual C++ Redistributable
- GPU 支持需要支持 CUDA® 的卡(Ubuntu 和 Windows)
推荐阅读
- git - 如何重新定位 git repo 的整个主分支
- python - 处理 CSV 文件时的 Pandas 数据帧 KeyError
- python - 尽管在 Python Tutor 中工作,但 Collatz Sequence 没有任何反应
- android - 获取 ListViews 的值并在编辑表单上显示
- regex - 匹配正则表达式模式的所有可能变体的正则表达式模式
- python - 访问html表中带空格的json对象
- sql - 对不同的日期范围应用不同的调整因子
- sympy - Sympy打印如何将e保留为e而不是数字
- python - 在 jupyter notebook 中总是出现运行时错误
- python - 仅从 OpenCV 中的边界框 (ROI) 中提取颜色特征