我正在尝试使用pip安装TensorFlow:
$ pip install tensorflow --user
Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow
我做错了什么?到目前为止,我使用Python和pip没有任何问题。
我正在尝试使用pip安装TensorFlow:
$ pip install tensorflow --user
Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow
我做错了什么?到目前为止,我使用Python和pip没有任何问题。
当前回答
2.0兼容方案:
在终端(Linux/MacOS)或命令提示符(Windows)中执行以下命令,使用Pip安装Tensorflow 2.0:
#Install tensorflow using pip virtual env
pip install virtualenv
virtualenv tf_2.0.0 # tf_2.0.0 is virtual env name
source tf_2.0.0/bin/activate
#You should see tf_2.0.0 Env now. Execute the below steps
pip install tensorflow==2.0.0
python
>>import tensorflow as tf
>>tf.__version__
2.0.0
在终端(Linux/MacOS)或命令提示符(Windows)中执行以下命令,使用Bazel安装Tensorflow 2.0:
git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow
#The repo defaults to the master development branch. You can also checkout a release branch to build:
git checkout r2.0
#Configure the Build => Use the Below line for Windows Machine
python ./configure.py
#Configure the Build => Use the Below line for Linux/MacOS Machine
./configure
#This script prompts you for the location of TensorFlow dependencies and asks for additional build configuration options.
#Build Tensorflow package
#CPU support
bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
#GPU support
bazel build --config=opt --config=cuda --define=no_tensorflow_py_deps=true //tensorflow/tools/pip_package:build_pip_package
其他回答
当我试图在我的Mac上安装(使用Python 2.7)时,我遇到了同样的错误。根据Yash Kumar Verma在本页上的不同回答,我在这里给出的类似解决方案似乎也适用于Windows 8.1上的Python 3
解决方案
第一步:进入TensorFlow安装页面的TensorFlow Python包的URL部分,复制相关链接的URL用于您的Python安装。
第二步:打开终端/命令提示符,执行以下命令: PIP install -upgrade[在这里粘贴复制的url链接]
所以对我来说是这样的: PIP安装——升级https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.2.0-py2-none-any.whl
更新(2017年7月21日):我和其他一些在Windows机器上运行Python 3.6的人尝试了这一点,他们必须将第2步中的行更改为: Python -m PIP install[在这里粘贴复制的url链接]
更新(2018年7月26日):对于Python 3.6.2(不是3.7,因为在TF文档中的3.6.2中),您还可以在步骤2中使用pip3 install——upgrade[粘贴复制的URL]。
我的环境:Win 10, python 3.6
pip3 install --upgrade tensorflow
pip install --upgrade tensorflow
错误:
> Collecting tensorflow Could not find a version that satisfies the
> requirement tensorflow (from versions: ) No matching distribution
> found for tensorflow
我还尝试了pip install tensorflow和pip install tensorflow-gpu。 但错误:
> Could not find a version that satisfies the requirement tensorflow (from versions: ) No matching distribution found for tensorflow
> Could not find a version that satisfies the requirement tensorflow-gpu (from versions: ) No matching distribution found for tensorflow-gpu
使用Step (https://www.tensorflow.org/install/install_windows)尝试安装OK
Follow the instructions on the Anaconda download site to download and install Anaconda. https://www.continuum.io/downloads Create a conda environment named tensorflow by invoking the following command: C:> conda create -n tensorflow pip python=3.5 Activate the conda environment by issuing the following command: C:> activate tensorflow (tensorflow)C:> # Your prompt should change Issue the appropriate command to install TensorFlow inside your conda environment. To install the CPU-only version of TensorFlow, enter the following command: (tensorflow)C:> pip install --ignore-installed --upgrade tensorflow To install the GPU version of TensorFlow, enter the following command (on a single line): (tensorflow)C:> pip install --ignore-installed --upgrade tensorflow-gpu
似乎有很多原因导致tensorFlow不能通过pip安装。我在windows 10上遇到的一个问题是,我的系统路径中没有支持的cudnn版本。截至目前(2017年12月),windows上的tensorflow只支持cudnn v6.1。因此,提供cudnn 6.1的路径,如果其他一切都正确,那么应该安装tensorflow。
在Windows 10上,这里的任何东西都不适合我。也许下面的一个更新的解决方案确实对我有用。
Python -m PIP install——升级tensorflow。
这是在Windows 10上使用Python 3.6和tensorflow 1.5
使用管理权限启动命令提示符 输入以下命令python -m pip install——upgrade pip 接下来输入命令pip install tensorflow